Iis – Restart IIS App Pool Automatically

application-poolsiis

We have a web application that is not completely bulletproof, and on occasion the application pool will die off and not restart without user input. Once it is restarted, it will run just fine for days or even months. Is there a way to have it restart on its own? IIS seems quick to kill off app pools that it sees misbehaving. Ideally the web app would be improved but that is not up to me in this case.

Best Answer

You know that out of the box, IIS (6.0) restarts all app pools every 29 hours? So, unless you've changed the settings, it's restarting itself almost daily anyway. When it dies, if it does it every few weeks/months, it's not because it's been up too long since the last restart.

Under what criteria would you have for triggering the app pool restart? Do you only know when the users start calling? Are there any event viewer entries that you can trigger off of? You can also tell IIS to restart a given app pool after a certain amount of memory consumed or number of requests done - maybe you can hook up some monitoring and figure out a threshold that means you need to do this, and then either do it through IIS, or if the condition is more complex, then instrument an automated way to call iisapp.vbs /a NamedAppPool /r

/Edit - re-read the OP, and you're saying that the application pool actually stops, on its own, and won't restart without the user manually recycling it? There should definitely be an application or system event viewer entry for that - you may have to turn up your IIS app-pool alerting to see it or it might already be there.