I am going to deploy my first MVC web application to the internet.

As is the first app with this framework for me, I was wondering if I can collect some advices regarding what should be done to prevent troubles.

I am generic on the question and this is xpressely done to collect the most various answers.



Thanks everybody for your answers. The question does not just regards the "deploy" scope but even more these scopes:

  • Security
  • Public Hosting
  • Application Management & Operations

In short, all the issue that need to be addressed from the initial deploy on.

Accepted Answer

If you are going to deploy within the hour:

  1. Make sure the reference to System.Web.Mvc is marked as Copy Local=True in your project. It tends to default to False, and so will not be copied to your bin folder, causing the app to fail when deployed. Review any additional assemblies you may have added to the project for Copy Local=True.

  2. Make sure stack traces aren't shown to end users when an exception occurs in your code. Use the <customErrors> in web.config to specify your own error page(s).

  3. In your web.config, make sure that the connection strings will work on the server you'll be deploying to.

  4. Is your application writing to disk for any reason? Logging perhaps? Some hosting services will not let your app write to disk -- worth checking ahead of time.

  5. Deploy to a local folder, and sanity-check that published app. Are scripts, stylesheets, images loaded without glitches?

If you have a little bit more time on your hands:

  1. Review the code for security, XSS considerations: are inputs sanitized? Is user input encoded correctly when rendered in views?

  2. Review the data schema. This may be your last opportunity to modify an empty database. Once you deploy, you can only hope to be gently updating live data, trying to avoid harming existing data and dependencies in application logic.

  3. If you haven't already, make sure to set up a google analytics account. You're going to be curious about how your site is being used, and this is one of the best free tools available. Goog analytics, as well as search engine registrations will require you to place files with funky names in the root 'folder' of your domain name. Verify that your app can serve files from the root folder, or set up a controller+routing to handle those requests.

Written by Oren Trutner
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki