Sco*_*tes 8 asp.net custom-errors iis-7.5 iis-express asp.net-mvc-3
使用Cassini但切换到IIS Express.我最初的想法是,<system.web>
除了以下内容之外我可以删除所有内容:
<authentication mode="Forms">
<forms loginUrl="/" />
</authentication>
Run Code Online (Sandbox Code Playgroud)
我以前customErrors
的设置是这样的:
<customErrors mode="On" defaultRedirect="/ServerError">
<error statusCode="404" redirect="/NotFound" />
</customErrors>
Run Code Online (Sandbox Code Playgroud)
我customErrors
切换到IISExpress时删除了这个元素.现在404不再重定向到我漂亮的"NotFound"页面了.
用于我的网站的AppPool Clr4IntegratedAppPool
让我知道它不使用Classic.
为什么IISExpress如此依赖于system.web
IIS 7.5使用system.webServer
?
好吧,我尝试了一些不同的东西:
改变existingResponse
以 PassThrough
作为注意这里
<httpErrors errorMode="Custom" existingResponse="Replace">
不!
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>
Run Code Online (Sandbox Code Playgroud)
为什么这个解决方案没有任何意义
替换 - 此值使自定义错误模块始终使用自定义错误模块生成的文本替换错误信息.如果existingResponse设置为"Replace",则Asp.Net/WCF生成的错误/异常将被IIS7错误替换.
http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx
归档时间: |
|
查看次数: |
3650 次 |
最近记录: |