Hi mfc_mobile,
Have you got any further ideas on this or does the things in our last reply
helps a little? If there're anything else we can help, please feel free to
post here. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
X-Tomcat-ID: 68687518
References: <u#**************@TK2MSFTNGP09.phx.gbl>
<11**********************@g49g2000cwa.googlegroups .com>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_0001_876B59EB"
Content-Transfer-Encoding: 7bit
From:
st*****@online.microsoft.com (Steven Cheng[MSFT])
Organization: Microsoft
Date: Tue, 08 Nov 2005 03:28:56 GMT
Subject: Re: Static Constructor & webservice
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Message-ID: <RB**************@TK2MSFTNGXA01.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
Lines: 184
Path: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8522
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
Thanks for Peter's inputs.
Hi mfc_mobile,
As Peter has mentioned, such things like "SessionState", "object instance
lifecycle..." or "static constructors or members" are all implementation
specific. From standard XML Webservice perspective, they're all transparent
to the webservice consumers, we should not reply on them when programming
through webservice.
As for your question, the .NET ASP.NET webservice implementation host the
webservice object instance in asp.net application (AppDomain). So the
webservice object/class and their static members are all available in the
application's AppDomain. Also, the static constructor will be called once
per Appdomain. For the webservice instance's lifecycle, it's hard to say,
because anytime when the instance is no longer used and being idle for long
time, runtime may release its reference and collect it.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
From: "Peter Kelcey" <Pe**********@telus.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: Static Constructor & webservice
Date: 7 Nov 2005 11:37:51 -0800
Organization:
http://groups.google.com
Lines: 16
Message-ID: <11**********************@g49g2000cwa.googlegroups .com>
References: <u#**************@TK2MSFTNGP09.phx.gbl>
NNTP-Posting-Host: 38.112.12.110
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1131392276 14853 127.0.0.1 (7 Nov 2005 19:37:56
GMT)
X-Complaints-To:
gr**********@google.com
NNTP-Posting-Date: Mon, 7 Nov 2005 19:37:56 +0000 (UTC)
In-Reply-To: <u#**************@TK2MSFTNGP09.phx.gbl>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET
CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.40607),gzip(gfe),gzip(gfe)
Complaints-To:
gr**********@google.com
Injection-Info: g49g2000cwa.googlegroups.com; posting-host=38.112.12.110;
posting-account=GTafkQ0AAAC3ac_UHAsxZ5oy6zhk-wpe
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.d ca.giganews.com!nntp.gigan
ews.com!postnews.google.com!g49g2000cwa.googlegrou ps.com!not-for-mail
microsoft.public.dotnet.framework.webservices:8515
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Webservices are stateless objects. This means that as soon as your
webmethod completes and returns to the calling client, then you class
variables are lost. Each call to your webservice instantiates a new
object. (Unless you start fooling around with using the session object
in your services to maintain data between calls.)
That is why service design requires a different frame of thought than
standard component design. With standard component design, you can pass
in parameters to a constructor and then reference those values later on
in various method calls. You can essential pass in your parameters in
pieces using multiple calls. With service design, you should pass in
all the parameters at once to your webmethod so that it will have all
of the information it needs to complete its tasks.
Peter Kelcey