I’d like to deploy my ASP.NET MVC application to a web hosting company (like DiscountASP.net). I’m confused about what needs to be in the web.config file on the web server. When I create the project locally, I get a bloated web.config with all sorts of additional modules, handlers, compilers. Do I need to add all these items to the production web.config file?
I’m still deploying my current ASP.NET application (not MVC) in IIS6 and I’ve always hand crafted a simple web.config for the production environment and uploaded it with the rest of the application files. It seems like with IIS7 I’m meant to use the IIS Manager on the web server to build the web.config. What’s the best way to build/manage the web.config on a production server?
So here’s what I’ve found so far trying to deploy my MVC application to DiscountASP.net.
The first think I found was that I had to make sure that System.Web.Mvc was deployed to the bin as it’s not installed in the GAC:
http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx
Then I started with a super basic web.config that just contained the database connection string. My application did not work.
Then I copied the mess that’s my local web.config up to the server and changed the database connection string and things started to work, but I was still getting the error message:
Then I found this article that explains how you need to change the web.config to support not using code behind files (you don’t need to do this with the local Visual Studio web server for some reason):
http://blog.benhall.me.uk/2009/01/aspnet-mvc-rc1-removing-code-behind.html
Personally, I don’t like how simple application settings such as connection strings and SMTP settings are getting mixed in with complex MVC (and AJAX.NET) infrastructure settings. One nice option would be for the hosting company (such as DiscountASP.net) to set up the Master.config (or a higher level web.config) to support MVC, so that my web.config would only need to contain my simple application settings.