不显示自定义错误页IIS的自定义错误 [英] IIS custom errors not showing custom error page

查看:119
本文介绍了不显示自定义错误页IIS的自定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET网站的自定义错误页的设置。

I have custom error pages setup on an ASP.NET website.

有是不显示自定义错误页,而仅仅显示通常的黄色ASP.NET错误页面有一个错误。如果打开它的自定义错误显示为In /应用程序服务器错误/运行时错误,但是,如果自定义错误是关闭显示视图状态MAC的验证失败的错误。

There is one error that is not showing a custom error page, and just showing the usual yellow ASP.NET error page. If custom errors are turned on it shows "Server error in / application" / "Runtime error", but if custom errors are off it shows "validation of viewstate mac failed" error.

我的web.config的有关部分是:

The relevant parts of my web.config are:

<system.web>
  <compilation debug="false" targetFramework="4.0" />
    <customErrors mode="On" redirectMode="ResponseRewrite">
      <error statusCode="404" redirect="/404.aspx" />
      <error statusCode="500" redirect="/500.aspx" />
    </customErrors>

<system.webServer>
  <httpErrors errorMode="DetailedLocalOnly" />

要捕获这个错误我必须使用不同的状态code或子状态code或者是有别的原因呢?

To trap for this error do I have to use a different status code or substatuscode or is there something else?

NB。 Server 2008 R2中,IIS 7。

NB. Server 2008 R2, IIS 7.

推荐答案

进一步研究后,我看到这意味着,IIS是显示错误,而不是ASP.NET。

After further research I see that this means that IIS is displaying the error rather than ASP.NET.

我改变了我的web.config的system.webServer一部分,所以IIS也可以使用自定义错误页,并且已经解决了这个问题。

I changed the system.webServer part of my web.config so IIS can also use the custom error page and that has solved the problem.

<system.webServer>
  <httpErrors errorMode="Custom" existingResponse="Replace">
    <remove statusCode="500" subStatusCode="-1" />
    <error statusCode="500" subStatusCode="-1" responseMode="ExecuteURL" path="/500.aspx" />
  </httpErrors>

这篇关于不显示自定义错误页IIS的自定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆