ASP.NET: How often is the WebService class created? How to make a permanent object in it?

A simple question, but I could not find the answer in google.

How often is a web service class created? Is it once per web service call, is it once per (arbitrary period of time), is it once after another?

EDIT

I was hoping the class lived for a long time, but it seems like it is not.

The fact is that I have a resource that is used in servicing requests, and downloading this resource every time is not an option again (on the contrary, loading it as soon as the IS option and very good performance is wise and simply “wise”). (No, no one will be upset, the resource will not be blocked, or something like that.)

So, how do I have an object in a web service, the only instance of which I can use to serve all requests? Sorry if the question has a too obvious answer, for example, "use a static variable". As an experienced programmer, I still have not been properly familiar with web programming and still struggle with some common concepts.

+3
source share
4 answers

So.

-, , . , - . IIS . , . , " ".

0

. , @fretje .

, System.Web.Services.WebService, .

, IHttpHandler, IsReusable

+1

- , .

, . , , . .

, - -, , - . (- - , - .)

OTOH, - Windows, - -.

0

Something that might seem useful is the wsdl.exe tool that comes with the .net framework. Here you can find some examples / documentation: http://msdn.microsoft.com/en-us/library/7h3ystb6%28VS.80%29.aspx

Basically, if you use this tool in the following format:

wsdl /language:VB /out:myProxyClass.vb http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL

You can create a proxy class file in which you can see everything that is happening on your system and perform audits, logs, etc. Hope this helps.

0
source

Source: https://habr.com/ru/post/1729564/


All Articles