Øyv*_*ind 17 asp.net-mvc application-error
我有一个基本的ASP.NET MVC2站点,每次加载视图(非部分视图)时都会记录单个"文件不存在"错误.我很确定这是因为我从主页面引用了一个不存在的文件,但我无法弄清楚它是哪一个.
堆栈跟踪没用(见下文).有没有人有关于如何最好地调试这个的任何提示?
File does not exist. : at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, 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)
Run Code Online (Sandbox Code Playgroud)
Cli*_*ity 55
正如您所说,它可能是您的母版页引用的丢失文件或图像.要捕获错误,请将以下错误处理程序添加到您的Global.asax
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex.Message == "File does not exist.")
{
throw new Exception(string.Format("{0} {1}", ex.Message, HttpContext.Current.Request.Url.ToString()), ex);
}
}
Run Code Online (Sandbox Code Playgroud)
然后,这应该告诉您页面请求的资源
| 归档时间: |
|
| 查看次数: |
30415 次 |
| 最近记录: |