views:

1413

answers:

6

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

A: 

What's the server environment? If it's not IIS7/Server 2008 there are other tweaks you have to do to get the routing to work correctly, although if that's the case you would probably get an error page, not a blank page.

Jason
A: 

If it's the production server that is having the problem, it is probably the role permissions. You need to make sure that all of the folders and files your application is using allow reading (and in some cases writing if your using logs) to the role identity that IIS is using.

Usually the identity IIS is using is in Web Site Properties -> Directory Security -> Edit (Authentication and access control). If you don't want to allow any computer on your network to access the website then you should probably turn off "Enable anonymous access". If you do want to allow this though, this will be the identity you need to give access to in your webapp folders and files. Otherwise you may need to give access to the role which contains the user identities you want to have access.

Daniel
I understand your point, but i am not using any authentication as i even disabled the authentication via web.config and only authentication i needed is to run db instance.I am not using any logging as well
Gripsoft
I think that maybe IIS authentication is something apart from the authentication settings in web.config, though I'm not sure. I think it's at least worth a try to turn on anonymous access in IIS and add that identity to the webapp folders and files.
Daniel
If it still doesn't work with those settings, then I'm not sure what else it could be because I've only seen a blank page as your describing when I had permission settings issues.
Daniel
A: 

From the looks of it I would expect that the first route would work if you were going to a url like /Home.aspx but if you are just going to the / url then ASP.net does not know how to handle the URL. It will try and match on IIS defaults pages like index.html, default.aspx, index.aspx, etc. If nothing is found then the request isn't getting anywhere. Trying creating a default.aspx (or any other index file in the route), then in the page_load do a response.redirect("~/Home.aspx").

If that doesn't work I would check out this source. One of the main reasons IIS 6 and MVC don't play nice is that IIS 6 by default does not have the wild card * mapped to the ASP.net dll.

I am sure it is a way that the product server is configured, can you do any comparison between your XP instance and production?

Kyle LeNeau
A: 

Do you have HTTP Handlers and Modules defined in web.config on production server?

 <httpHandlers>
  <remove verb="*" path="*.asmx"/>
  <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
  <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
 </httpHandlers>
 <httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
 </httpModules>

On IIS6, URLs must contain .mvc (eg. /Products.mvc/ListAll). Check these guides for proper IIS 6 configuration and .mvc extension workaround:

Deploying ASP.NET MVC to IIS 6

Using ASP.NET MVC on IIS 6 without the .MVC Extension

Jozef Izso
+1  A: 

I solved the issue, the major issue was the different versions of MVC framework. Production Server was having MVC Beta while i have installed MVC RC1. So as soon as i installed the RC1 on the server as well as run the mvc extension registeration scripts, everything worked Thanks for your help guys

Gripsoft
+2  A: 

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));
}
Michel van Engelen