,最好的办法是捕捉服务器最后一个错误和的AppDomain例外。
所有这些都可以在Global.asax.cs文件中完成。
检查以下步骤:
1-在Global.asax.cs中,抓住最后一个错误并记录它。
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
Server.ClearError();
log.Error("Application Error caught in Global ", exception);
}
2 - 添加上的AppDomain UnhandledException事件的事件处理程序,这应该被添加到的Application_Start:
protected void Application_Start(object sender, EventArgs e)
{
//....
AppDomain.CurrentDomain.UnhandledException
+= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
3-这里是CurrentDomain_UnhandledException执行:
void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
if (e != null)
log.Error("Domain Unhandled Exception: ", e.ExceptionObject as Exception);
}
快乐编码:)
太糟糕了,没有人真的直接回答了关于**的问题哪些事件**在处理错误后触发。 – 2013-11-10 17:22:16