<authentication mode="Forms"> <forms loginUrl="/" /> </authentication>
我之前的customErrors设置如下:
<customErrors mode="On" defaultRedirect="/ServerError"> <error statusCode="404" redirect="/NotFound" /> </customErrors>
我切换到IISExpress时删除了这个customErrors元素.现在404不再重定向到我漂亮的“NotFound”页面了.
用于我的网站的AppPool是Clr4IntegratedAppPool,它让我知道它不使用Classic.
解决方法
>将existingResponse更改为Passthrough,如here所示
< httpErrors errorMode =“Custom”existingResponse =“Replace”>
不!
>如评论here中所述,设置TrySkipIisCustomErrors = false
Notta!
我最终通过简单地将existingResponse更改为Replace来使其工作.
>谁知道!
这就是system.webServer现在的样子:
<httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" path="/NotFound" responseMode="ExecuteURL" /> <remove statusCode="500" subStatusCode="-1" /> <error statusCode="500" path="/ServerError" responseMode="ExecuteURL" /> </httpErrors>
为什么这个解决方案没有任何意义
Replace – This value make custom error module to always replace the
error information with text generated by custom error module. If
existingResponse is set to “Replace”,errors/exceptions generated by
Asp.Net/WCF are replaced by IIS7 errors.
http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx
原文地址:https://www.jb51.cc/aspnet/248328.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。