views:

135

answers:

4

Hello,

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!

UPDATE:

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.

+7  A: 

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.

Oren Trutner
+2  A: 

No. 0: make sure the patch for the padding oracle vulnerability is applied, of course this doesn't just applies to asp.net MVC but any asp.net application.

eglasius
@eglasius: do you mean oracle databases? Can you please edit the answer to add some reference to the patch you're talking about?
Lorenzo
@Lorenzo no, for the recent asp.net vulnerability, added a link to my blog post that goes over what its impact was on mvc, and also one to the ms note about it being in all distribution channels now (like windows update).
eglasius
@eglasius: Good. +1!
Lorenzo
+1  A: 

If you are deploying your MVC site in your own server with IIS 5.1 or 6:

  1. Make sure to add mapping for extension .* with executable path to aspnet_isapi.dll and verbs GET,HEAD,POST,DEBUG not necessary in IIS 7.
  2. If you are adding your MVC application in root website, do 1 in the root website e.g. Default Web Site if on a Virtual Directory do 1 in Virtual Directory.
  3. Make sure all scripts and css includes finds the correct path when deployed.

If you are deploying your MVC site in a shared hosting, where you don't have an access to the IIS settings.

  1. Make sure you have added the right httpHandlers in your web.config so to the url rewritting can map correctly to the right pages.
  2. Another way is to add custom Routing in your MapRoutes. e.g. add some extension (.aspx) in your Default maproute. ({controller}.aspx/{action}/{id}). But I do not advice this.
rob waminal
A: 

Palermo, Bogard etc. 's book ASP.NET MVC 2 in Action, from Manning is an excellent source of information on using MVC, and has a chapter dedicated to Deployment Techniques available for free at: http://github.com/jeffreypalermo/mvc2inaction/tree/master/manuscript/Chapter17/

I think this will probably have everything you need.

smartcaveman