The ASP. NET Site is occasionally restarted inexplicably. What causes it is unknown. After some tossing, I summarized the 10 causes of the restart of the ASP. NET site.
1. Reclaim the application pool will cause the site to restart. The reason for recording is:
HostingEnvironment initiated shutdown HostingEnvironment caused shutdown
2. modifying the application pool recycle rule will cause a restart. Record the restart reason:
HostingEnvironment initiated shutdown HostingEnvironment caused shutdown
3. Modifying the site name in IIS will not cause restart
4. Modify the web. config configuration file in the root directory of the site. adding a few spaces in the configuration file comment will cause the restart. The record causes the restart:
CONFIG change HostingEnvironment initiated shutdown
However, modifying the web. config file in the subdirectory may not necessarily cause immediate restart.
5. If you modify the aspx file, the master file may not be restarted. However, each modification may result in a re-compilation. After the number of re-compilation times reaches 15, the site will be restarted. the restart reason is:
Recompilation limit of 15 reached HostingEnvironment initiated shutdown
After 15 times, restart this number and configure it in web. config. Modify the numRecompilesBeforeAppRestart attribute value of compilation.
<Compilation debug = "false" numRecompilesBeforeAppRestart = "15">
6. Deleting the pdb file in the bin directory will cause a restart. The record causes the restart:
Change Notification for critical directories.
Creating an empty folder in the bin directory will cause the site to restart. The reason is:
Directory rename change notification for 'd: projectsTestWebAppTestWeb '. T estWeb dir change or directory rename
Deleting an empty folder in the bin directory causes the site to restart. The record is as follows:
Directory rename change notification for 'd: projectsTestWebAppTestWeb '. T estWeb dir change or directory rename
7. Modifying the Global. asax file will cause the site to restart, even if a few spaces are added, the record causes the restart:
Change in GLOBAL. ASAX HostingEnvironment initiated shutdown
8. Modifying the App_Code directory will cause the site to restart
Adding a folder named App_Code under the root directory of the site causes a restart. The record causes the restart:
Change Notification for critical directories. App_Code dir change or directory rename
Deleting the App_Code folder causes the site to restart. The record causes the restart:
File Change Notification Error in D: projectsTestWebAppTestWebapp_code
Change Notification for critical directories.
App_Code dir change or directory rename
Creating or deleting a cs file under the App_Code folder causes the site to restart. The record is as follows:
Change Notification for critical directories. App_Code dir change or directory rename
9. Modifications to the Key Path will cause the site to restart. The key paths include:
Bin, App_Code, Web References, App_Browsers, App_GlobalResources, App_LocalResources
10. In addition, the scan of files by antivirus software may cause the ASP. NET Process to mistakenly believe that the file or key path has changed, and may also cause a restart.
The above is my summary of the 10 reasons that led to the restart of the ASP. NET site. In general, there are three reasons for site restart: on the one hand, IIS configuration changes; on the other hand, ASP. NET-related file configuration files, global files, aspx, ascx, master files, and other types of files; the third aspect is the Key Path bin, app_Code, Web References, App_Browsers, App_GlobalResources, app_LocalResources has changed.
How can I record the reason why the ASP. NET site is restarted?