How to troubleshoot "System.Web.HttpException (0x80004005): File does not exist"?

Sorry, if the answer was already given on this site, I searched, but did not find this exact scenario.

I am adding log4net to the WCF service. I added a handler to the Application_Error event, and it catches a file not found error with every request.

I saw this with websites, and usually the error can be traced to the absence of a favicon file in the root directory or to the missing image specified in the css stylesheet.

However, this is a WCF service, there is no CSS stylesheet, and adding an icon to the root did not solve the problem.

Is there anyone else a good way to fix this problem?

Some tips:

  • I have not deployed this to a real IIS server yet, I am running it locally.
  • The error does not occur when I start in DEBUG inside Visual Studio, only when I access the service from a web browser (IE or Chrome).
  • I added the URL and path to the error message, and these are these:

    URL: http: // localhost: 3994 /

    FilePath: /

    Error: System.Web.HttpException (0x80004005): The file does not exist.

Edit: the above values ​​are what appears in the excluded log:

protected void Application_Error(object sender, EventArgs e) { var objErr = Server.GetLastError().GetBaseException(); if (objErr is System.Web.HttpException) { var filePath = Context.Request.FilePath; var url = ((HttpApplication) sender).Context.Request.Url; Log.Error("URL: " + url + "; FilePath: " + filePath, objErr); } else Log.Error("Application Error", objErr); } 

Any help would be greatly appreciated.

+8
source share
1 answer

Probably the reason is that the service is not specified. When the web server (the local developer too) receives a request for a folder, it scans this folder for the default page (usually called: index.htm, index.html, default.asp, default.aspx, etc.) And (if you are not using a REST-based service description). When you start VS, debugging will lead you directly to the actual service.

In this case, since you created the service, you need to specify the location of the exact service, i.e. http://localhost:3994/service.svc .

In addition: if you start a debugging session and then change the URL to http://localhost:3994/ , you can verify this in the case of the debugger.

+6
source

All Articles