I'm having some trouble deploying an ASP.net MVC 2 RC 2 application to my production box. I have it working well in both dev and test. The key difference seems to be that the production box has not yet been upgraded to IIS 7.5. When I go to the site I just get a blank page as is described in I am getting a blank page while deploying MVC application on IIS.
I've tried most things listed there without avail. I have tried using both the integrated and classic configurations for .net 4 and tried going to a specific controller and action just in case it was something to do with the default file. What I did try that, oddly, worked was changing the routing such that it used .mvc extensions as one might do for IIS6. I would like to avoid doing that. I have added logging in application_error but nothing is ever thrown in there. I actually have an ASP.net MVC 1 application on the same machine which works fine. I also just tried putting in a default document like in my asp.net mvc 1 app
string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
HttpContext.Current.RewritePath(originalPath, false);
This worked fine for the / document but any links off of that still return a blank page.
Has anybody got an idea what it is I should be doing?
"HTTP Errors" and "HTTP Redirection" services must be added to the "Web Server (IIS)" role in the "Server Manager" control panel. If you want to get static content like CSS and Javascript working, too, enable "Static Content" service as well.
Just thought I'd add another reason why IIS / MVC might return a blank page... suppose you've got an app pool identity, which is authorised against the SQL database. Now suppose you've got two different identities, one for production, and one for pre-production. Now, further suppose that one of your esteemed colleagues decides to restore the database from production, over the one that exists in pre-production. Now you've got a copy of the prod database in pre-prod, which is authorised for the production user, but not for the pre-production user. In that situation, I was getting blank pages in pre-production now, because the authorisation for the pre-production user (which previously existed in the pre-production database) has now been wiped out by the restore of the database. Because that user ID is the app pool identity, now your MVC app no longer has rights to the database. This caused MVC to render blank pages, and caused me two days of chasing my tail because I thought someone had changed some IIS setting on the web server, but it was actually a database permissions issue. Maybe this will give a clue to someone with a similar problem in the future.
I also had not installed the HTTP Redirection role but I had a further issue that I thought I'd document here in case someone else has the same issue.
I had zipped the program folder up using 7-Zip and transferred it to the prod server. When I unzipped it the web.config file in the Views folder had been added as a folder called web.config with the config file inside. Moving the file out and deleting the folder sorted this for me.
The clue was in the Event Viewer so check there too if the other answers don't completely help.
No more blank page for me now.