I'm using Log4Net and logging everytime my ASP.NET-Application throws an error:
每次我的ASP.NET-Application抛出错误时,我都在使用Log4Net并进行日志记录:
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".
唉,每次我访问我的应用程序页面时,都会捕获到System.Web.HttpException,“文件不存在”。
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.
我没有任何线索如何调试,这发生在我的ASP.NET开发服务器和IIS 7.5上我部署它。
3 个解决方案
#1
21
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:
我敢打赌,这是Google Chrome总是要求的favicon.ico以及您忘记包含的内容。但是要确保您可以跟踪请求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.
或其他类似robots.txt的内容,例如网页抓取工具尝试抓取您的网站时。
#2
0
I have same error:
我有同样的错误:
There were some file references in CSS. That does not exist in directory. So it gave this error. I created Image Files, so error disappeared.
CSS中有一些文件引用。目录中不存在。所以它给出了这个错误。我创建了图像文件,因此错误消失了。
So make sure that file reference that you have given is exists in your directory
因此,请确保您所提供的文件引用存在于您的目录中
#3
0
Check your HTML output of your page in case of using url with tilda "~/"
如果使用带有tilda的网址“〜/”,请检查您网页的HTML输出
You need to use @Url.Content() to fix it
您需要使用@ Url.Content()来修复它
http://clubmicrosoft.net/post/2014/02/28/File-does-not-exist.aspx
http://clubmicrosoft.net/post/2014/02/28/File-does-not-exist.aspx
#1
21
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:
我敢打赌,这是Google Chrome总是要求的favicon.ico以及您忘记包含的内容。但是要确保您可以跟踪请求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.
或其他类似robots.txt的内容,例如网页抓取工具尝试抓取您的网站时。
#2
0
I have same error:
我有同样的错误:
There were some file references in CSS. That does not exist in directory. So it gave this error. I created Image Files, so error disappeared.
CSS中有一些文件引用。目录中不存在。所以它给出了这个错误。我创建了图像文件,因此错误消失了。
So make sure that file reference that you have given is exists in your directory
因此,请确保您所提供的文件引用存在于您的目录中
#3
0
Check your HTML output of your page in case of using url with tilda "~/"
如果使用带有tilda的网址“〜/”,请检查您网页的HTML输出
You need to use @Url.Content() to fix it
您需要使用@ Url.Content()来修复它
http://clubmicrosoft.net/post/2014/02/28/File-does-not-exist.aspx
http://clubmicrosoft.net/post/2014/02/28/File-does-not-exist.aspx