我在用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上也试过了,在Global.asax.cs中注释掉了整个Global.asax.cs,但仍然不起作用。
发布于 2012-08-10 10:47:37
尝试删除redirectMode="ResponseRewrite"属性
CustomErrors does not work when setting redirectMode="ResponseRewrite"
https://stackoverflow.com/questions/11899171
复制相似问题