Why would an aspx file return 404 (“The page cannot be found”)

前端 未结 13 1555
日久生厌
日久生厌 2020-12-24 01:42

Why when I access an aspx (e.g., http://www.example.com/foo.aspx - not the real site) through IE6 would I get a 404 Error (i.e., \"The page cannot be found\") in IIS6

<
相关标签:
13条回答
  • 2020-12-24 02:12

    If you register the .NET 4 version of IIS, you may find it's grabbed the registration of the aspx extension. If ASP.NET v4 is prohibited then 404 will be returned

    0 讨论(0)
  • 2020-12-24 02:22

    Ray and Joe probably have it. In order to serve any file type, IIS has to have a mapping for it. Aspx files require that they be mapped to the AspNet ISAPI dll, which the .Net installation normally takes care of. If you install IIS after .Net (and I'm sure there are other situations), you have to initiate this yourself by running aspnet_regiis.

    0 讨论(0)
  • 2020-12-24 02:22

    I had bin\roslyn compiler missing. Adding that all worked fine.

    0 讨论(0)
  • 2020-12-24 02:23

    I had this issue where some customers were reporting the 404.0 and some didn't have the problem at all(same page). I was able to navigate to any of the pages with no problems from my machine. Some customers would refresh and it would go away. I am using .Net 4.5.2 and IIS 7.5.

    Looking at the IIS log file I would see:

    sc-status sc-substatus sc-win32-status
    404 0 2

    sc-status.sc-substatus: 404.0 - Not Found
    sc-win32-status: 2 - ERROR_FILE_NOT_FOUND
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx https://en.wikipedia.org/wiki/HTTP_404

    I found the problem was I had deployed a new version of the website in which the old version of the website had RouteConfig.cs/FriendlyUrlSetting setup by creating a project using the web forms template. The new version was created using an empty template. So obvious to me now.. no URL routing. Customers had a cache issue with certain pages on their machine(no .aspx extension) and having them clear browser data ultimately fixed the problem.

    0 讨论(0)
  • 2020-12-24 02:25

    I just happened to find another culprit for this issue. My foo.aspx page referenced a particular master page that had a <%@ Register %> directive to a user control that did not exist. Removing the reference to the non-existent user control caused my foo.aspx to load instead of 404.

    0 讨论(0)
  • 2020-12-24 02:25

    The site is pointing to a different directory where the page is not.

    It could be permissions, however I would think you would get an access error instead.

    I'm assuming you are running IIS.

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