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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Joseph
  • 25,330
  • 8
  • 76
  • 125

1 Answers1

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.

danludwig
  • 46,965
  • 25
  • 159
  • 237
Dustin Laine
  • 37,935
  • 10
  • 86
  • 125
  • 1
    Awesome, I totally didn't know that existed. – Joseph Oct 29 '10 at 19:22
  • 1
    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. – Martin Clemens Bloch Jun 14 '13 at 13:55
  • @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? – Cadab Jul 18 '13 at 13:41
  • @Cadab 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. – Martin Clemens Bloch Jul 22 '13 at 19:53