Home:ALL Converter>Log IIS Application Pool Startup, Shutdown, and Recycle

Log IIS Application Pool Startup, Shutdown, and Recycle

Ask Time:2010-12-10T06:35:28         Author:Jeremy Mattingly

Json Formatter

My application is running in a shared hosting environment. I do have a dedicated App Pool for my app. I've been doing some testing with 1st visits and precompile performance and have been tracking when my application starts up and shuts down.

In my Global.asax I have some logging code in Application_Start and Application_End. I can see from my logs generally when the application is idle and shuts down, then someone visits and it starts back up.

But, I also see cases where a shutdown is logged and then followed by another shutdown about 13 minutes later; without a startup in the middle.

I also see instances where there are two Startups in a row. I'm guessing these might be a recycle, but why wouldn't there be a shutdown log entry?

What I'd really like to know if there is a better way to track when my application starts, when it shuts down and if it is shutdown due to an idle pool, or from a recycle. I don't have access to the Windows Event Log so I need to do this from my app if possible.

Author:Jeremy Mattingly,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/4403838/log-iis-application-pool-startup-shutdown-and-recycle
yy