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

Den*_*ger 12 c# asp.net log4net exception application-error

每次我的ASP.NET-Application抛出错误时,我都在使用Log4Net并进行日志记录:

    protected void Application_Error(object sender, EventArgs e)
    {
        Exception ex = Server.GetLastError();
        Log.Error("An error occurred", ex);
    }
Run Code Online (Sandbox Code Playgroud)

唉,每当我访问我的应用程序页面时,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)
Run Code Online (Sandbox Code Playgroud)

我没有任何线索如何调试,这发生在我的ASP.NET开发服务器和IIS 7.5上我部署它.

Dar*_*rov 21

我打赌这favicon.ico是谷歌Chrome总是要求你忘记包括.但是要确保您可以跟踪请求URL:

protected void Application_Error(object sender, EventArgs e)
{
    Exception ex = Server.GetLastError();
    Log.Error("An error occurred", ex);
    Log.Error("Requested url: ", Request.RawUrl);
}
Run Code Online (Sandbox Code Playgroud)

现在在您的日志文件中,您应该看到:

Requested url: /favicon.ico
Run Code Online (Sandbox Code Playgroud)

或其他类似robots.txt例如网络抓取工具尝试抓取您的网站的情况.