I'm troubleshooting restarts in an ASP.NET application. The application is restarting about 20 times a day. I'm logging using the log4net library. Following advice from this question, I have the application logging the reason for the shutdown from HostingEnviornment.ShowdownReason
inside the Application_End()
event in Global.asax. I also log when the application starts up in the Application_Start()
event.
After running the logs for several days, I've found that when a shutdown is actually logged, the reason for the restart is always HostingEnvironment
. But the shutdown is not always logged. I know that because I can see Application_Start()
log events that don't have a corresponding Application_End()
event.
What would cause the hosting environment to restart my application? Is there a way to get more specific information about why it decided to trigger the restart? Does the fact that the shutdown event is not always logged shed any light on what may be causing the restarts?
UPDATE
I'm still struggling with this. Links from around the web seem to indicate that using WinDbg/SOS.dll/ADPlus.vbs will be necessary to track down the cause of this issue. But between learning how to use these tools and figuring out how to correctly interpret the results, it seems to come with a very steep learning curve. I'm kind of still hoping there is something out there that can help me track down the cause of the restarts without resorting to disassembling CLR code. Does anyone have any other tools or tricks that can help me with this?
来源:https://stackoverflow.com/questions/17428720/how-can-i-get-more-detail-about-asp-net-app-restarts-than-hostingenvironment-shu