【发布时间】:2012-08-10 09:48:20
【问题描述】:
我正在使用 MVC2。
我的 webconfig 说
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/internal-server-error">
<error statusCode="500" redirect="~/internal-server-error" />
<error statusCode="404" redirect="~/not-found" />
</customErrors>
我的测试方法说
public ActionResult ErrorTest()
{
var z = 0;
var x= 3/z;
return null;
}
我仍然得到默认的运行时错误 Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.,而不是我的自定义错误方法,它甚至没有被调用。
为什么? 这是一个开发服务器问题吗?它可以在 IIS 上运行吗?
编辑:也在 IIS Express 上尝试过,在 Global.asax.cs 中注释掉了整个 Application_Error,仍然无法正常工作。
【问题讨论】:
标签: asp.net-mvc iis custom-errors