473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

My WebService Seems to be Loading Everytime it is invoked

I'm coming from an ISAPI background and migrating code to Webservices.

In the ISAPI world, there are sections of code that are invoked only once
when the DLL is loaded by IIS. It's a place where you can do time-consuming
resource loading once and only once.

In .NET Webservices, I figured that the section at the bottom of this
message would be called once upon the loading of the Webservice. From that
point on, only the methods exposed in the service would be invoked. At
least that was my theory.

Now perhaps this is a lack of understanding of how the ASPNET services load.
In the ISAPI world, the first time the ISAPI module is invoked it generally
stays in IIS memory until you end or restart IIS services (an option to
"cache ISAPI services". That is for speed in a production environment.
This can be a pain in the butt when you are debugging, since you have to
stop/start IIS every time you compile and link a revision.

In .NET, I notice that I can always rebuild my Webservice without restarting
IIS and perhaps that means ASPNET by default doesn't stay in memory after
invocation.

So my question is this: Is there a similar caching option for ASPNET
services or does that startup code invoke everytime someone hits a
Webmethod?

TIA

Harry

public Service1()
{

InitializeComponent();

}
Nov 23 '05 #1
2 1340
"Harry Whitehouse" <ha***@envmgr.com> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
I'm coming from an ISAPI background and migrating code to Webservices.

In the ISAPI world, there are sections of code that are invoked only once
when the DLL is loaded by IIS. It's a place where you can do
time-consuming
resource loading once and only once.

In .NET Webservices, I figured that the section at the bottom of this
message would be called once upon the loading of the Webservice. From
that
point on, only the methods exposed in the service would be invoked. At
least that was my theory.

Now perhaps this is a lack of understanding of how the ASPNET services
load.
In the ISAPI world, the first time the ISAPI module is invoked it
generally
stays in IIS memory until you end or restart IIS services (an option to
"cache ISAPI services". That is for speed in a production environment.
This can be a pain in the butt when you are debugging, since you have to
stop/start IIS every time you compile and link a revision.

In .NET, I notice that I can always rebuild my Webservice without
restarting
IIS and perhaps that means ASPNET by default doesn't stay in memory after
invocation.

So my question is this: Is there a similar caching option for ASPNET
services or does that startup code invoke everytime someone hits a
Webmethod?

TIA

Harry

public Service1()
{

InitializeComponent();

}


ASP.NET Web Services are by default stateless. That's a fancy way of saying
that each call to a Web Service method creates a new instance of the Web
Service class which knows nothing of previous calls unless you specifically
implement it somehow. That's why the constructor is invoked every time
someone hits a Web method.

That said, one-time initialization can be done in the Application_Start
handler in the Global class. Web Services can also be made stateful by using
cookies and session state, the price being that the service will then be
less scalable.

When you recompile the Web Service, ASP.NET detects that it has changed and
restarts the application automatically without requiring you to restart IIS.

Regards,
Sami
Nov 23 '05 #2
Thank you Sami!!!

Harry
Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: john sparrow | last post by:
Hi There! I have an ATL Server Webservice created with the VS Wizard. In that service I wish to Initialize an ISAPI service (through a call to the m_spServiceProvider member) for that handler....
6
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
2
by: farseer | last post by:
Hi, I have a few webservice questions i'd like to bounce of you... 1. Can a webservice contain a paramterized contructor ( can't the contructor take parameters )? 2. If two users make an...
0
by: James A Taber | last post by:
We've created a webservice using .Net 2003. We got a report from a consumer of the service and did some work to trace down the problem. To reproduce, I created a VB desktop client with a single...
11
by: Andy | last post by:
Make the story short, I have a VB.NET client interface calling .NET webservice, written in VB.NET as well. I am trying to make the client as thin as possible so I let the webservice part to...
4
by: MacLanca | last post by:
Hi, I've done the HelloWorld WebService, installed in a WebServer (INTERNET) When I call it with Windows App it works, if I use a webform it doesn’t (INTERNET) Both of them work in the INTRANET...
1
by: Gary Howlett | last post by:
Hi Im using VS 2005 C#; Is there any issues I should be aware of if I add my webservice as a static variable to my main class? The reason im asking is should I create an object of my...
7
by: Nick | last post by:
Hi there, Is it possible to tell how a WebMethod was invoked? For example I would like to determin if it was invoked via SOAP or HTTP Post. Other than creating 2 methods I am no sure if I can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.