Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting a blank page while deploying MVC application on IIS

I am currently deploying my application built using RC of MVC ASP.NET on the production server which is showing nothing now. The routes in my global.ascx are typical i.e.

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 = "" }
        );

Can any one figure out why it is showing me only blank pages

Sorry i forget to mention the it is IIS 6

Interestingnly it is also working on my local IIS (i.e. both local built in with VS & standard with XP) as well

like image 779
Gripsoft Avatar asked Feb 17 '09 17:02

Gripsoft


1 Answers

You will also get a blank page when you have error handling setup in your global.asax and something generic is wrong (like an assembly that could not be found).

When you disable it in the global.asax, you can see the server error. Don't forget to enable it again after fixing those initial bugs.

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));
}
like image 62
Michel van Engelen Avatar answered Oct 11 '22 07:10

Michel van Engelen