//

DEPLOYING ASP.NET MVC APPLICATIONS

In a continuous integration environment, deploying ASP.NET MVC applications are done by a click of a button, triggered by a check-in, and then many moving parts of the integration service will take care of distributing the artifacts to the relevant servers. But here we are discussing about how to get your ASP.NET code to be tested on a local IIS server environment. So let’s start with dependancies, and what needs to be included with the deployment.

High level ASP.NET MVC website dependencies are:

  • The .NET Framework
  • Static content - eg: javascript, css, images and content folders
  • External services - eg: database, web services etc

What to include with deployment:

  • /bin/folder - compiled code
  • Special files - eg: Web.Config, Global.asax
  • Static content - eg: javascript, css, images and content folders
  • ASP.NET MVC diverges when it comes to views - include everything under Views folder

What not to include:

  • Source code files (already included as compiled binaries)

Deployment checklist

  • What system-level applications and APIs does the application require (eg: OS version, IIS version, .NET Framework version) - does any software need to be installed on the server?
  • What system level folders or files does teh application require?
  • Does the application require databases?  - is it properly configured (ie. users created etc)? - have there been any updates to the database scheme since the last release?
  • What other servers or services does the application interact with? (firewall rules etc)
  • Do I have all of the appropriate licenses purchase and available? 

Deploying to IIS

  • Hosting ASP.NET MVC is similar to ASP.NET
  • Ensure that the target web server has .NET 4.0 or later

ASPNET add_application

Run the following script against the database to add a login as a member of a fixed server role. (or use  [http://msdn.microsoft.com/en-us/library/ee677634.aspx](ALTER SERVER ROLE) instead as this will be deprecated soon)

ASPNET default_apppool_sql

If getting an access denies error, try adding the server name for database.

ASPNET add_connection

Right click on the project and select publish to publish the web site.

ASPNET publish_web

Run the following command on Visual Studio Command Prompt.

7a1a1e73-b9af-476d-9818-e9c96d32f220

Change the connection string to meet these shared settings.

And voilà,  it's out there to be tested!