Asp.net mvc 如何在本地调试.net IIS自定义HTTP错误
我想调试处理站点中所有HTTP错误的控制器。web.config中有以下内容Asp.net mvc 如何在本地调试.net IIS自定义HTTP错误,asp.net-mvc,debugging,iis,custom-error-pages,Asp.net Mvc,Debugging,Iis,Custom Error Pages,我想调试处理站点中所有HTTP错误的控制器。web.config中有以下内容 <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" /> <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" /> <remove statusCode="5
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/Error/ServerError" />
</httpErrors>
Error/ServerError
的控制器没有命中,我得到了标准的黄色详细错误页面
文件说明
如果将errorMode值设置为Custom,IIS将仅返回Custom
发送给所有请求浏览器的错误消息
谢谢这个问题可能很棘手,这取决于您使用的是哪个版本的IIS或VS Dev服务器,是asp.net还是IIS本机,等等。。此链接可能有帮助我正在使用IIS 7.5您可以尝试customErrors元素
throw new HttpException(500, "error, I cant be bothered");