【发布时间】:2020-09-16 13:22:24
【问题描述】:
我有这个配置可以正常工作并正确重定向以下错误
<httpErrors errorMode="Custom"
existingResponse="Replace"
defaultResponseMode="ExecuteURL" >
<remove statusCode="403" />
<remove statusCode="404" />
<remove statusCode="500" />
<error statusCode="403" responseMode="ExecuteURL" path="/Error/AccessDenied" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/PageNotFound" />
<error statusCode="500" responseMode="ExecuteURL" path="/Error/ApplicationError" />
</httpErrors>
但是当我添加以下默认路径来尝试添加全部捕获
<httpErrors errorMode="Custom"
existingResponse="Replace"
defaultResponseMode="ExecuteURL"
defaultPath="/Error/ApplicationError">
服务器抛出 web.config 错误
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Module CustomErrorModule
现在这与documentation on msdn 直接矛盾
任何帮助将不胜感激!
【问题讨论】:
-
这个答案对我有帮助 serverfault.com/a/53713/243181 对于 IISExpress applicationHost.config 可以在另一个位置找到 - stackoverflow.com/a/12946477/2164198
-
@IvanSamygin:没有为我修好。
-
有人解决了吗?我有完全相同的问题。好像defaultPath不起作用。
-
有人找到解决办法吗?
-
好吧,这行得通(iis 配置设置),我只是有 existingResponse="Auto" 而不是 existingResponse="Replace"。我的错,对不起。
标签: asp.net iis-7 web-config custom-error-pages