为什么aspx文件返回404(“无法找到页面”)

时间:2022-10-09 21:46:17

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

为什么当我访问aspx(例如,http://www.example.com/foo.aspx——而不是真正的站点)时,我将会得到一个404错误(即:在IIS6中,“页面无法找到”)。

I've got scripts enabled for the website and I've tried with executables enabled as well.

我已经为网站启用了脚本,并且我也尝试了可执行文件。

Here is the full error:

这里是完整的错误:

The page cannot be found
The page you are looking for might have been removed, had its name changed, or
is temporarily unavailable. 
------------------------------------------------------------------------------

Please try the following:

Make sure that the Web site address displayed in the address bar of your 
browser is spelled and formatted correctly. 
If you reached this page by clicking a link, contact the Web site 
administrator to alert them that the link is incorrectly formatted. 
Click the Back button to try another link. 
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)

------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the 
words HTTP and 404. 
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for 
topics titled Web Site Setup, Common Administrative Tasks, and About Custom 
Error Messages. 

I can get to Default.htm in the same directory, so I know the path is right. I've opened it up to everyone (temporarily) so I know the permissions are right.

我可以默认。htm在同一个目录中,所以我知道路径是正确的。我已经向所有人(临时)开放了,所以我知道权限是正确的。

11 个解决方案

#1


59  

It could be a lot of things. I had this issue today because .NET had not been re-initialized after installing IIS (aspnet_regiis -i -enable or equivalent).

它可能是很多东西。我今天遇到了这个问题,因为。net在安装了IIS (aspnet_regiis -i -enable或等效)之后没有重新初始化。

#2


4  

Check that the anonymous user under which the site runs has read access to the file foo.aspx.

检查站点运行的匿名用户是否读取了文件foo.aspx的访问权限。

IIS6 and later uses a 404 response, thereby not letting an attacker know whether such a file even exists.

IIS6和稍后使用404响应,因此不会让攻击者知道是否存在这样的文件。

#3


4  

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.

我碰巧发现了这个问题的另一个原因。我的foo。aspx页面引用了一个特定的母版页,它对不存在的用户控件有<%@ Register %>指令。删除对不存在的用户控件的引用导致了我的foo。要装载而不是404。

#4


1  

I found a solution here. The real catch was using this:

我找到了一个解决办法。真正的收获是:

Response.TrySkipIisCustomErrors = true;

#5


0  

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.

我假设你在运行IIS。

#6


0  

Check that www.example.com is going to the site that you think it is.

请检查www.example.com是否进入你认为它的网站。

If you are hosting multiple sites on the same IP using host headers you may want to double check the name you are using is going to the site you think it is.

如果您在同一个IP上托管多个站点,使用主机头,您可能想要重复检查您正在使用的名称是否会进入您认为的站点。

#7


0  

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.

雷和乔可能有。为了提供任何文件类型,IIS必须有一个映射。Aspx文件需要映射到AspNet ISAPI dll,这是。net安装通常需要处理的。如果在。net之后安装IIS(我确信还有其他的情况),您必须通过运行aspnet_regiis来启动它。

#8


0  

ALTERNATE SOLUTION (same error perhaps different cause).

替代解决方案(可能是不同的原因)。

I had installed Visual Studio 2008 Pro without SQL Express it, and it caused this same error. Reinstallation of VS2008 with sql express included seemed to have corrected the problem, or perhaps the install took other actions. I did try to register ASP.net numerous times prior but no luck however it is definitely the most probable cause Just posting my experience for those pulling their hair as I was..

我安装了Visual Studio 2008 Pro,没有SQL Express,它也导致了同样的错误。包含sql express的VS2008的重新安装似乎已经纠正了这个问题,或者可能是安装采取了其他操作。我确实尝试过多次注册ASP.net,但是运气不太好,但这绝对是最可能的原因,只是把我的经验告诉了我。

Thanks

谢谢

#9


0  

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

如果您注册了。net 4版本的IIS,您可能会发现它已经获得了aspx扩展的注册。如果ASP。禁止使用NET v4,然后返回404。

#10


0  

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.

我有一个问题,有些客户报告404.0,有些客户根本没有问题(相同的页面)。我能够导航到任何一页,没有任何问题从我的机器。一些客户会刷新,它会消失。我使用。net 4.5.2和IIS 7.5。

Looking at the IIS log file I would see:

查看IIS日志文件,我将看到:

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

scl状态scl -substatus, scl -win32-status, 404 0。

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

sc-status。scl -substatus: 404.0 -未找到sc-win32状态: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.

我发现问题是我已经部署了一个新版本的网站,旧版本的网站有了RouteConfig。通过使用web forms模板创建一个项目,cs/ friendlyurlset设置。新版本是使用一个空模板创建的。现在我明白了。没有URL路由。客户在他们的机器上有一个特定页面的缓存问题(没有。aspx扩展),并且有了清晰的浏览器数据,最终解决了问题。

#11


0  

I got this issue when I tried using a different drive to host my apps. I ended up moving them to the wwwroot folder because it was working there and I did not have to time figure out why it is not working on the E:\ drive.

当我尝试使用不同的驱动器来托管我的应用程序时,我遇到了这个问题。最后,我把它们移到wwwroot文件夹,因为它在那里工作,我不需要花时间弄清楚为什么它不在E:\ drive上工作。

#1


59  

It could be a lot of things. I had this issue today because .NET had not been re-initialized after installing IIS (aspnet_regiis -i -enable or equivalent).

它可能是很多东西。我今天遇到了这个问题,因为。net在安装了IIS (aspnet_regiis -i -enable或等效)之后没有重新初始化。

#2


4  

Check that the anonymous user under which the site runs has read access to the file foo.aspx.

检查站点运行的匿名用户是否读取了文件foo.aspx的访问权限。

IIS6 and later uses a 404 response, thereby not letting an attacker know whether such a file even exists.

IIS6和稍后使用404响应,因此不会让攻击者知道是否存在这样的文件。

#3


4  

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.

我碰巧发现了这个问题的另一个原因。我的foo。aspx页面引用了一个特定的母版页,它对不存在的用户控件有<%@ Register %>指令。删除对不存在的用户控件的引用导致了我的foo。要装载而不是404。

#4


1  

I found a solution here. The real catch was using this:

我找到了一个解决办法。真正的收获是:

Response.TrySkipIisCustomErrors = true;

#5


0  

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.

我假设你在运行IIS。

#6


0  

Check that www.example.com is going to the site that you think it is.

请检查www.example.com是否进入你认为它的网站。

If you are hosting multiple sites on the same IP using host headers you may want to double check the name you are using is going to the site you think it is.

如果您在同一个IP上托管多个站点,使用主机头,您可能想要重复检查您正在使用的名称是否会进入您认为的站点。

#7


0  

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.

雷和乔可能有。为了提供任何文件类型,IIS必须有一个映射。Aspx文件需要映射到AspNet ISAPI dll,这是。net安装通常需要处理的。如果在。net之后安装IIS(我确信还有其他的情况),您必须通过运行aspnet_regiis来启动它。

#8


0  

ALTERNATE SOLUTION (same error perhaps different cause).

替代解决方案(可能是不同的原因)。

I had installed Visual Studio 2008 Pro without SQL Express it, and it caused this same error. Reinstallation of VS2008 with sql express included seemed to have corrected the problem, or perhaps the install took other actions. I did try to register ASP.net numerous times prior but no luck however it is definitely the most probable cause Just posting my experience for those pulling their hair as I was..

我安装了Visual Studio 2008 Pro,没有SQL Express,它也导致了同样的错误。包含sql express的VS2008的重新安装似乎已经纠正了这个问题,或者可能是安装采取了其他操作。我确实尝试过多次注册ASP.net,但是运气不太好,但这绝对是最可能的原因,只是把我的经验告诉了我。

Thanks

谢谢

#9


0  

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

如果您注册了。net 4版本的IIS,您可能会发现它已经获得了aspx扩展的注册。如果ASP。禁止使用NET v4,然后返回404。

#10


0  

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.

我有一个问题,有些客户报告404.0,有些客户根本没有问题(相同的页面)。我能够导航到任何一页,没有任何问题从我的机器。一些客户会刷新,它会消失。我使用。net 4.5.2和IIS 7.5。

Looking at the IIS log file I would see:

查看IIS日志文件,我将看到:

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

scl状态scl -substatus, scl -win32-status, 404 0。

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

sc-status。scl -substatus: 404.0 -未找到sc-win32状态: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.

我发现问题是我已经部署了一个新版本的网站,旧版本的网站有了RouteConfig。通过使用web forms模板创建一个项目,cs/ friendlyurlset设置。新版本是使用一个空模板创建的。现在我明白了。没有URL路由。客户在他们的机器上有一个特定页面的缓存问题(没有。aspx扩展),并且有了清晰的浏览器数据,最终解决了问题。

#11


0  

I got this issue when I tried using a different drive to host my apps. I ended up moving them to the wwwroot folder because it was working there and I did not have to time figure out why it is not working on the E:\ drive.

当我尝试使用不同的驱动器来托管我的应用程序时,我遇到了这个问题。最后,我把它们移到wwwroot文件夹,因为它在那里工作,我不需要花时间弄清楚为什么它不在E:\ drive上工作。