我想为我的网站设置自定义错误,在本地主机mode="On"
上正常工作。自定义错误不工作在实际的网站404
但是在实际网站上同样失败。
下面是我的web.config
<customErrors mode="RemoteOnly" defaultRedirect="~/error/Message.aspx?msg=The page you requested could not be found.">
<error statusCode="404" redirect="~/error/Default.aspx?PID=32"/>
<error statusCode="403" redirect="~/error/Forbidden.aspx"/>
<error statusCode="400" redirect="~/error/Error.aspx"/>
<error statusCode="500" redirect="~/error/InternalError.aspx"/>
</customErrors>
我用我的本地机器上的IIS 7.5,同样被Web服务器上使用的代码。
我是否需要更改生产服务器上的任何特定设置,使其工作
错误消息我仍然得到活网站404
Not Found
The requested document was not found on this server.
Web Server at xyz.com
我注意到,当我加'XXX/abc.aspx'然后404个作品,如果我这样做像'xxx /文件夹/'或'abc.com/abc /'那么它不起作用.. – Learning
嗨,我认为,在这里你可以找到解决方案:[post](http://stackoverflow.com/questions/ 6101110/IIS7的Web服务器,自定义错误 - 作品 - 在本地的但不-时发布对产品)。有关[IIS参考](http://www.iis.net/configreference/system.webserver/httperrors)中的更多详细信息。 –