Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Task when AppPool is recycled

Status
Not open for further replies.

jdemmi

MIS
Jun 6, 2001
1,106
US
Any ideas for this one???

W2K3 .Net 1.1 app.

We have IIS configured to recycle the app pool when the virtual memory reaches a certain threshold.

This is an OOB IIS option and is handy for cleaning up the LOH.

Now....here's my dilemma.

I have a "dependent service" when needs to be recycled any and every time the app pool is recycled.

For now I am handling this manually but I would love to find a way to automate it....any suggestions?

-- Jason
"It's Just Ones and Zeros
 
use either the ApplicationBegin or ApplicationEnd to handle starting/stopping global services to the site.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Can you elaborte?

Keep in mind that the recycling event is managed internal by Microsoft (IIS) (not my app).

-- Jason
"It's Just Ones and Zeros
 
the root object to the asp.net pipeline is HttpApplication. when you add a global.asax file the code behind reads
Code:
public class Gloabl : HttpApplication 
{ 
}
from this object you can hook into a variety of points in the pipeline. Application_Start executes the first time the website is accessed no users to 1 user. Application_End executes as the application is shutting down. this can be when the app pool is recycled. after the last user has been inactive for a period of time, etc.

so when the application starts, start the service, and when the application ends, stop the service. I forget the exact objects to use but it's something like
Code:
Process p = new Process("[commands to start service]");
p.Start();
p.WaitOne();

Process p = new Process("[commands to stop service]");
p.Start();
p.WaitOne();

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top