Last post Oct 15, 2018 06:18 AM by Zhi Lv - MSFT
Oct 11, 2018 11:40 PM|jzero|LINK
Is there a way to know if my website got down due to Application Pool Recycle or Idle-Timeout?
The idea is register in a log file what caused website shutdown, my global.asax already register a shutdown at Application_End, and would like register when down due
AppPool Recycle or Idle-Timeout.
Oct 12, 2018 04:02 PM|jzero|LINK
After some more research, found what can fit my needs.
ApplicationShutdownReason Enum returned by
As far Enum covers all AppDomain Shutdown Reason, there is no specific AppPool Recycle or Idle-Timeout, in my tests found that any change in AppPool (config values or state) causes return ShutdownReason = HostingEnvironment
Oct 15, 2018 06:18 AM|Zhi Lv - MSFT|LINK
Please refer to Jani's reply in
There is an application pool shutdown time limit in iis. Let's say it's 60 seconds and in shared hosting environment there is an application pool memory limit. Your application pool reaches this limit and iis tells the application pool to finish all
the work with current requests. If all the requests finish processing before 60 seconds is passed, application_end will trigger and application pool will gracefully shut itself down. However if 60 seconds pass and requests are still being processed, IIS gets
upset and kills the app pool. This time no application_end would trigger. Similarly, no error event handler would be triggered.
So, if you want to check the Application Pool recycle log, I suggest you could refer to the following articles to enable Application Pool recycle logging in IIS and find the logs.
How to enable Application Pool recycle logging.
Troubleshooting badly behaving IIS application pools