Asp.net mvc 在应用程序中找不到文件异常\u错误
大家好,我是asp.net mvc的新手。有时我在Asp.net mvc 在应用程序中找不到文件异常\u错误,asp.net-mvc,exception,Asp.net Mvc,Exception,大家好,我是asp.net mvc的新手。有时我在应用程序\u Error中出现异常,并将其写入日志文件: Error in global.asax System.Web.HttpException: File does not exist. at System.Web.StaticFileHandler.ProcessRequestForNonMapPathBasedVirtualFile(HttpRequest request, HttpResponse response) a
应用程序\u Error
中出现异常,并将其写入日志文件:
Error in global.asax
System.Web.HttpException: File does not exist.
at System.Web.StaticFileHandler.ProcessRequestForNonMapPathBasedVirtualFile(HttpRequest request, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context)
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我正在尝试调试,但看不到文件名?如何查看找不到的witch文件?
谢谢当您调试时,您能在请求中看到该请求是对图像、js文件或类似资源的请求吗
有时,当我收到一个不存在的图像请求(可能在css文件中引用)时,我会收到此消息。在
Global.asax
文件中添加以下方法
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
Log.Error("An error occurred", ex);
Log.Error("Requested url: ", Request.RawUrl);
}
Request.RawUrl
给出给出错误的确切url
现在,在日志文件中,您应该看到:
Requested url: /favicon.ico
谢谢您的回复(这是图像文件)我忘记了这个请求