Search code examples
.netapplication-poolapplication-startrecycle

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


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.


Solution

  • 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.