这是我在这个伟大的编程信息源中的第一篇文章。使用IIS6而不是web.config设置显示的自定义错误页面
我为客户开发了新的网站,只是做了一些收尾工作。
我试图创造条件,从的web.config
<system.web>
<customErrors mode="RemoteOnly">
<error statusCode="404" redirect="404.aspx" />
<error statusCode="500" redirect="500.aspx" />
</customErrors>
它运作良好,对当地的开发机,并根据需要显示404和500错误读取自定义错误页。
编译和发布网站到Web服务器后,它不起作用。 IIS 6不断显示原始IIS 6的错误页面这样的404错误:
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)
我不知道为什么会这样,我还以为web.config文件覆盖原来的IIS6设置。
好的我发现问题是只有404 .aspx页面。错误500工作正常,并显示500.aspx页面。但不适用于404.aspx。请指点
+1这是一个很好的问题,写得很好。但是,我认为它已被问及充分回答 - http://stackoverflow.com/questions/133225/asp-net-iis-404-for-all-file-types 该问题是特定于404错误,但它同样适用于其他类型的错误。 – 2010-01-28 11:34:05