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

后端 未结 3 1620
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 02:23

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

    protected void Application_Error(object sender, EventArgs e)
    {
              


        
相关标签:
3条回答
  • 2020-12-11 02:33

    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.

    So make sure that file reference that you have given is exists in your directory

    0 讨论(0)
  • 2020-12-11 02:34

    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.

    0 讨论(0)
  • 2020-12-11 02:37

    Check your HTML output of your page in case of using url with tilda "~/"

    You need to use @Url.Content() to fix it

    http://clubmicrosoft.net/post/2014/02/28/File-does-not-exist.aspx

    0 讨论(0)
提交回复
热议问题