What is the best way to force an Application Start when an Application Pool is recycled?
Asked Answered
S

1

7

I'm wondering if there is a way to automagically fire off an Application Start for a web site/application whenever the Application Pool for that site is recycled?

Are there any canned solutions for this problem?

I would really like to avoid having one of my end users have to go through the application start of the site if they can avoid it.

Swartz answered 29/10, 2010 at 18:18 Comment(0)
O
6

If you are using .NET 4 you can.

<applicationPools>
     <add name="MyAppWorkerProcess" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" />
</applicationPools> 

See more information at ScottGu's article Auto-Start ASP.NET Applications.

Other than this I have heard of people writing a service to make a request every few minutes. A little overkill, imo, but depends on your need.

Organizer answered 29/10, 2010 at 18:34 Comment(4)
Awesome, I totally didn't know that existed.Swartz
This requires IIS 7.5 or above right? I cannot get it to work in IIS 7... help? EDIT: Nvm it works in IIS 7.Centra
@MartinClemensBloch I'm trying to get this working in IIS 7, but i get an error that "startMode" is not recognized. Did you have todo anything else to get it working?Yachting
@Yachting I dont remember if I fixed something else, restarted the IIS or just tried again. But it should definitely work in IIS 7. Btw there might be a slight delay between setting that setting and the worker thread starting.Centra

© 2022 - 2024 — McMap. All rights reserved.