- The ASP.NET\Application Restarts performance counter is incremented for each restart.
- If you use in-memory session state, session variables are lost.
- Application state is lost.
- The Application_Start and the Application_End events are executed repeatedly.
However, the old versions of the compiled code remain in memory indefinitely with side-by-side execution. When you update many files (for example, more than 30 files), if you do not restart the application to clear the old versions from memory, too much memory may be used. To work around this problem, ASP.NET has a feature in which the application is automatically restarted after a particular number of files are updated.
The restart should occur only one time for the whole list of updated files. After the application restart, old versions should not reside in memory. Therefore, the application should not have to be restarted to recompile new versions of files. However, this problem occurs when you load many new .aspx or .ascx files to the server (for example, 61 files). The server unloads the application when the first 15 files are recompiled and every time another 15 files are recompiled until the server reaches 61. This results in four application restarts even though only one is required.
NOTE: If ASP.NET consumes too much memory, ASP.NET restarts that application automatically.
If you are updating a known number of files, and if you want to restart the application automatically, set numRecompilesBeforeAppRestart to a number that is just less than the number of files that will be updated. This causes a single application restart with a small number of old assemblies in memory. For example, set numRecompilesBeforeAppRestart as follows:
<compilation debug="false" explicit="true" numRecompilesBeforeAppRestart="50" defaultLanguage="vb">
For additional information about ASP.NET features, click the article number below to view the article in the Microsoft Knowledge Base:
ID do Artigo: 319947 - Última Revisão: 24 de mar de 2009 - Revisão: 1