Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Web.HttpException File does not exist - Page loads just fine (ASP.NET)

I'm using Log4Net and logging everytime my ASP.NET-Application throws an error:

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

Alas, everytime I visit a page on my application, a System.Web.HttpException is caught, "File does not exist".

Here's the Stack Trace:

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)

I don't have any clue how to debug this, this happens on my ASP.NET Development Server and on an IIS 7.5 I deploy it on.

like image 474
Dennis Röttger Avatar asked Mar 01 '12 14:03

Dennis Röttger


1 Answers

I bet it's the favicon.ico that Google Chrome always requests and which you forgot to include. But to be sure you could trace the request 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);
}

Now in your log file you should see:

Requested url: /favicon.ico

or something else like robots.txt when for example web crawlers attempted to crawl your site.

like image 199
Darin Dimitrov Avatar answered Oct 12 '22 13:10

Darin Dimitrov