我正在尝试在 MVC 3 中实现全局未处理的异常日志记录。我已经像这样设置了我的 web.config..
<customErrors mode="On" defaultRedirect="/error/">
<error statusCode="500" redirect="/error/http500"/>
<error statusCode="404" redirect="/error/http404"/>
</customErrors>
当我为控制器触发异常时,它会按预期重定向到错误页面。问题是,当我Server.GetLastError()
在 Global.asax 中使用时,异常总是
"The view 'Error' or its master was not found or no view engine supports the searched locations. The following locations were searched:\r\n~/Views/deanslist/Error.aspx\r\n~/Views/deanslist/Error.ascx\r\n~/Views/Shared/Error.aspx\r\n~/Views/Shared/Error.ascx\r\n~/Views/deanslist/Error.cshtml\r\n~/Views/deanslist/Error.vbhtml\r\n~/Views/Shared/Error.cshtml\r\n~/Views/Shared/Error.vbhtml"
我期待它提供实际抛出的异常。我究竟做错了什么?