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.
camainc
source share