Asp.net mvc HttpErrors existingResponse=";替换“;防止MVC的自定义错误处理

Asp.net mvc HttpErrors existingResponse=";替换“;防止MVC的自定义错误处理,asp.net-mvc,asp.net-mvc-3,web-config,http-status-code-404,Asp.net Mvc,Asp.net Mvc 3,Web Config,Http Status Code 404,我正在使用MVC3应用程序中的[HandleError]属性处理错误。这很好,但为了让它起作用,我需要补充一点 <system.web> <customErrors mode="On" /> 为了处理404错误,我将其添加到系统中。webserver即IIS配置,而不是asp.net <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCo

我正在使用MVC3应用程序中的
[HandleError]
属性处理错误。这很好,但为了让它起作用,我需要补充一点

<system.web>
     <customErrors mode="On" />

为了处理404错误,我将其添加到系统中。webserver即IIS配置,而不是asp.net

<httpErrors errorMode="Custom" existingResponse="Replace">
   <remove statusCode="404" />
   <error statusCode="404" responseMode="ExecuteURL" path="/404page" />
</httpErrors>

这很简单,适用于404。在这里添加这个的原因是,它看起来像是一个没有任何自定义代码的通用工具。existingResponse=“Replace”是必需的,其他模式会导致404不被处理

问题在于,当existingResponse=“Replace”时,CustomErrors不再起作用。它只返回一个没有详细信息的错误


这两种模式只是相互排斥吗?我知道我可以为其他404解决方案编写代码,但理想情况下,我希望这个简单的配置更改能够起作用,或者理解为什么它无法完成。

不是一个直接的答案,但发现它对我有效,而不是使用
existingResponse=“replace”