我能从Application_End()参数中获得任何有趣的数据吗?
本文关键字:任何 数据 Application End 参数 | 更新日期: 2023-09-27 17:56:11
在我部署在Windows Azure上的 ASP.NET 应用程序中,我希望记录尽可能多的有用数据。有Application_End()
方法:
protected void Application_End(object sender, EventArgs e)
{
}
它被调用sender
是System.Web.HttpApplicationFactory
,e
只是System.EventArgs
。有了这样的参数,我所能做的就是记录它们的类型,这不是很有用。
我可以从这些参数中获得任何有用的数据吗?是否存在使用具有其他(更有用)实际类型的参数调用Application_End()
的情况?
IIS,class HttpRuntime
包括,源代码可以下载。仔细分析表明,事件参数确实总是相同的,并且没有传达任何有用的信息。事件的调用堆栈也是无用的 - 它总是
my Application_End(Object sender, EventArgs e)
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.HttpApplication.InvokeMethodWithAssert(MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs)
at System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context, MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs, HttpSessionState session)
at System.Web.HttpApplicationFactory.Dispose()
at System.Web.HttpRuntime.Dispose()
at System.Web.HttpRuntime.ReleaseResourcesAndUnloadAppDomain(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
但。。。有一些System.Web.Hosting.HostingEnvironment.ShutdownReason
可以从Application_End()
中检索,并且由启动应用程序关闭时由HttpRuntime
设置。
所以"有趣的数据"是System.Web.Hosting.HostingEnvironment.ShutdownReason
.
另请参阅此密切相关的问题