My applic开发者_如何学Cation 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.
Application_Start and Application_End should only be called once per lifetime in your application, MSDN confirms this.
Without knowing your hosting environment it is possible that your web host is running your website over multiple worker pools or IIS instances. Your application pool could also be unexpectedly crashing due to other apps in the pool.
Without access to the Event Log or anything other than a basic web host control panel your best way of logging is what you're doing now, using Global.ASAX
精彩评论