HostingEnvironment initiated shutdown exception logged in Event log

In the last couple of days we received several tickets where you asked us what does it mean and why this exception is being logged in the Event log. You can find more information about it in this blog post.
There are several possible causes of this issue, mostly caused by .Net framework or settings of IIS application pool:

- The application pool in IIS can be set to recycle the application if some limits are exceeded - CPU usage, Memory, idle time.
- .Net is restarting application automatically when there is a change in web.config file, BIN, App_Code directory and other directories. It is the standard .Net behavior (Why might a .NET web application (app domain) restart? The reasons may surprise you).
- Another possible option is that the number of recompilation was reached. .Net framework is restarting automatically the application after a specified number of compilations - e.g. you have edited some code files, etc. This can be set in web.config file, default value is 100:
<compilation debug="false" numRecompilesBeforeAppRestart="100">

You can also find some more information in this knowledge base article. I hope it will help.

UPDATE (12/18/2009):
One of my colleagues sent me another link related to this problem and it is very useful – there are discussed all the reasons of this and also how to solve it. Here is the link: ASP.NET Case Study: Lost session variables and appdomain recycles.

Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.