Tag: 应用程序错误

System.Web.HttpException文件不存在 – 页面加载很好(ASP.NET)

每次我的ASP.NET-Application抛出错误时,我都在使用Log4Net并进行日志记录: protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); Log.Error(“An error occurred”, ex); } 唉,每次我访问我的应用程序页面时,都会捕获到System.Web.HttpException ,“文件不存在”。 这是堆栈跟踪: bei System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) bei System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) bei System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) bei System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() bei System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 我没有任何线索如何调试,这发生在我的ASP.NET开发服务器和IIS 7.5上我部署它。

如何获取哪个页面在aspx中向Application_error抛出exception

我在global.asax中有一个常规exception处理程序Application_error,我试图在所有页面中隔离所有未捕获的exception。 我不想使用Page_error来捕获exception,因为在很多页面上调用它是低效的。 那么在exception中我可以找到实际导致exception的页面?