执行自定义错误页面时抛出异常

时间:2014-10-20 21:45:09

标签: asp.net asp.net-mvc iis custom-errors

我有一个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());
    }

所以我不知所措。我该怎么调试呢?

0 个答案:

没有答案