IIS 404自定义错误未正常工作 [英] IIS 404 Custom Error not working as expected

查看:209
本文介绍了IIS 404自定义错误未正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作IIS6,ASP.NET,VS2008。该网站使用了自定义错误处理程序来捕获404错误和服务于其它页面。当presented与形式的网址:

I'm working on IIS6, ASP.NET, VS2008. The web site uses a custom error handler to catch 404 errors and serve an alternate page. When presented with an url of the form:

的http:// SRV /深红/用品/指数

http://srv/crimson/articles/index

一切完美的作品。但形式的网址:

Everything works perfectly. But an url of the form:

HTTP://srv/crimson/blog.aspx

http://srv/crimson/blog.aspx

在哪里blog.aspx不存在,失败,出现以下消息:

Where blog.aspx does not exist, fails with the following message:

在'/深红应用程序中的服务器错误。说明:HTTP 404 ...

Server Error in '/Crimson' Application. Description: HTTP 404...

当我尝试和调试,没有在我的404处理器断点被击中。所以会出现的东西正在迎头赶上请求早。哪里?我怎么把它在我的处理程序传递请求?

When I try and debug, none of the breakpoints in my 404 handler are hit. So it appears that something is catching the request earlier. Where? And how to I get it to pass the request on to my handler?

修改
感谢那些谁回答,但没有这些思想工作。我已经决定要攻击这个问题的另一种方式。

Edit Thanks to those who answered, but none of those ideas worked. I've decided to attack the problem another way.

推荐答案

您可能想试试这个:

在IIS6:


  • 开启属性为您的网站

  • 进入主目录标签

  • 点击配置

  • 查找扩展名的.aspx

  • 单击编辑

  • 检查哪些写着确认文件是否存在复选框

修改

和这个什么:
<一href=\"http://msdn.microsoft.com/en-us/library/h0hfz6fc\">http://msdn.microsoft.com/en-us/library/h0hfz6fc(VS.80).aspx

And what about this: http://msdn.microsoft.com/en-us/library/h0hfz6fc(VS.80).aspx

<customErrors defaultRedirect="sorry.htm" mode="On">  
     <error statusCode="404" redirect="NotFound.aspx"/>
</customErrors>

由于'仅限远程指定定制错误仅示出到远程客户端,以及ASP.NET错误显示到本地主机。

Since 'RemoteOnly' specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host.

这篇关于IIS 404自定义错误未正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆