protected virtual void Application_End(object sender, EventArgs e)
{
HttpRuntime runtime = (HttpRuntime) typeof(HttpRuntime).InvokeMember(
"_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);
if (runtime == null)
return;
string shutDownMessage = (string) runtime.GetType().InvokeMember(
"_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
string shutDownStack = (string) runtime.GetType().InvokeMember(
"_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
log.InfoFormat("Application has shut down.");
log.DebugFormat(" Shutdown message:{0}", shutDownMessage);
log.DebugFormat(" Shutdown stack:\n{0}", shutDownStack);
initializationError = null;
}