Asp.net mvc 5 仅对MVC中的给定区域禁用customErrors

Asp.net mvc 5 仅对MVC中的给定区域禁用customErrors,asp.net-mvc-5,custom-errors,Asp.net Mvc 5,Custom Errors,我已在我的MVC5web应用程序中启用了customErrors,如下所示 <customErrors defaultRedirect="/Error/InternalServerError" mode="On"> <error redirect="/Error/NotFound" statusCode="404" /> <error redirect="/Error/InternalServerError" statusCode="500" /> &

我已在我的
MVC5
web应用程序中启用了
customErrors
,如下所示

<customErrors defaultRedirect="/Error/InternalServerError" mode="On">
  <error redirect="/Error/NotFound" statusCode="404" />
  <error redirect="/Error/InternalServerError" statusCode="500" />
</customErrors>

但我的自定义错误仍在显示,如何仅对MVC5中的给定区域禁用
customErrors

将您的自定义错误包装在根目录下的位置标记中web.config:

  <location path="areaName">
      <system.web>
        <customErrors mode="Off" />
      </system.web>
  </location>

  <location path="areaName">
      <system.web>
        <customErrors mode="Off" />
      </system.web>
  </location>