用日志組件,Global 中配置的輸出最后一個錯誤信息,總是出現下面的錯誤信息:
2014-04-01 14:35:41,757 級別:ERROR 信息:[Exception]:
System.Web.HttpException (0x80004005): 文件不存在。
在 System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
在 System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
在 System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError().GetBaseException(); if (ex != null) PubFunction.ErrorLogPrint(ex.StackTrace + ":" + ex.TargetSite.Name, ex.Message);//書寫錯誤日志 Response.Redirect("~/404.aspx");//轉向提示界面 }
網上查詢在http://blog.csdn.net/yanbuodiao/article/details/7384037中發現
在調試過程中直接跟蹤Server -> Non-Public Members -> _context -> Request -> AppRelativeCurrentExecutionFilePath這個級別的信息,在這個信息中
終於發現了一張圖片的路徑信息,而這張圖片的路徑已經發生改變 。所以找不到此圖片報錯
直接在整個項目級別,查找使用這張圖片的地方,把路徑修改正確,終於沒有錯誤了