我在IIS上部署MVC应用程序时得到一个空白页面

Gri*_*oft 17 asp.net asp.net-mvc

我目前正在生产服务器上部署使用MVC ASP.NET的RC构建的应用程序,现在什么都没有显示.我的global.ascx中的路由是典型的

routes.MapRoute(
            "Default",                                              // Route name
            "{controller}.aspx/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        );
        routes.MapRoute(
          "Root",
          "",
          new { controller = "Home", action = "Index", id = "" }
        );
Run Code Online (Sandbox Code Playgroud)

任何人都可以弄明白为什么它只显示空白页面

对不起,我忘了提到它是IIS 6

有趣的是它也在我的本地IIS上工作(即本地内置的VS和标准的XP)

Mic*_*len 19

如果在global.asax中设置了错误处理设置,并且泛型错误(如无法找到的程序集),您还将获得一个空白页面.

在global.asax中禁用它时,您可以看到服务器错误.在修复这些初始错误后,不要忘记再次启用它.

protected void Application_Error(object sender, EventArgs e)
{
    Exception exception = Server.GetLastError();
    RouteData routeData = new RouteData();
    routeData.Values.Add("controller", "ErrorController");
    routeData.Values.Add("action", "HandleTheError");
    routeData.Values.Add("error", exception);

    Response.Clear();
    Server.ClearError();

    IController errorController = new ErrorController();
    errorController.Execute(new RequestContext(
        new HttpContextWrapper(Context), routeData));
}
Run Code Online (Sandbox Code Playgroud)


Gri*_*oft 2

我解决了这个问题,主要问题是MVC框架的版本不同。生产服务器有 MVC Beta,而我已经安装了 MVC RC1。因此,一旦我在服务器上安装了 RC1 并运行 mvc 扩展注册脚本,一切就正常了,谢谢你们的帮助