我有一个MVC4应用程序,我正在尝试配置自定义错误页面,但是当我强制执行异常时,我得到以下内容:
Server Error in '/' Application.
Runtime Error
Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
到目前为止我做了什么:
首先,我在<system.web>
中的web.config中设置以下内容:
<customErrors mode="On" defaultRedirect="Error" />
我已尝试Error.aspx
和~/Views/Shared/Error.aspx
(这是Error.aspx的位置)
这是Error.aspx:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title>Error1</title>
</head>
<body>
<div>
An error occured.
</div>
</body>
</html>
注册全局过滤器(在Global.asax中):
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
所以我不知所措。我该怎么调试呢?