Thursday, June 16, 2011

ASP.Net Application Restarts

What Causes Application Restarts?

There are a few reasons why an ASP.NET application can be restarted. For the most part, an application is restarted to ensure that latent bugs or memory leaks don’t affect in the long run the overall behavior of the application. Another reason is that too many dynamic changes to ASPX pages may have caused too large a number of assemblies (typically, one per page) to be loaded in memory. Any application that consumes more than a certain share of virtual memory is killed and restarted. The ASP.NET runtime environment implements a good deal of checks and automatically restarts an application

if any the following scenarios occur:

The maximum limit of dynamic page compilations is reached. This limit is
configurable through the
web.config file.

The physical path of the Web application has changed, or any directory under
the Web application folder is renamed.
Changes occurred in global.asax,machine.config, or web.config in the application root, or in the Bin directory or any of its subdirectories.

Changes occurred in the code-access security policy file, if one exists.
Too many files are changed in one of the content directories. ( Typically, this
happens if files are generated on the y when requested.)
Changes occurred to settings that control the restart/shutdown of the ASP.
NET worker process. These settings are read from machine.config if you don’t
use Windows 2003 Server with the IIS 6.0 process model. If you’re taking full
advantage of IIS 6.0, an application is restarted if you modify properties in the
Application Pools node of the IIS manager.

In addition to all this, in ASP.NET an application can be restarted programmatically by calling HttpRuntime.UnloadAppDomain.

No comments:

Post a Comment