ASP.NET MVC3 Web Role Deployment in Windows Azure (SDK 1.4) – Detailed steps and Full Sample

Please be sure to have Visual Studio 2010 (or Visual Web Developer)  along with Windows Azure SDK 1.4 Refresh  installed in your machine. 

Get the full working Sample at:

1. Please create a MVC2 Web Role as below:


2: In the Visual Studio when solution is ready now add a new project as below:


3: Create a new “Web” based “ASP.NET MVC 3 Web Application” as below:

4:  When asked to select the MVC3 Web Application
type please select “Internet Application” along with View Engine “Razor” as


5: Lets compare references in “Web Role” and “MVC 3 Web Application”
you will see something as below:


6: You will need to add & remove following references in your Web Role. 


start by removing System.web.MVC from Web Role first and then add the following references
in the Web Role:

reference from location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC

  • System.Web.Mvc.dll


All below references from location: c:\Program Files
(x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\

  • Microsoft.Web.Infrastructure
  • System.Web.Helpers
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor


Step 7: Please be sure to set “Copy Local as True”
for all above modules, like as below:


Step 8:  Now
open Web Role Based web.config and replace with ASP.NET MVC 3 based Web.Config
as below:


<?xml version="1.0"?>
For more information on how to configure your ASP.NET application, please visit
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add key="webpages:Version" value=""/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<compilation debug="true" targetFramework="4.0">
<add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
<roleManager enabled="false">
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="" newVersion="" />



Step 9: Now remove "ASP.NET MVC3 Web Application" from your solution. The final solution will look like as below:


Step 10. Lets take a final look at our included references


Step 11. Now test your application in development fabric and verify it working successfully as below:


Step 12: Now package and deploy your application to Windows Azure Management Portal and test it working successfully  in as below:


Get the full working Sample at:

Comments (2)

  1. Bart Czernicki says:

    You should also change the GUID of the application to MVC3, because you do not get the nice VS 2010 tooling around adding controllers and stuff in MVC2:…/mvc3-release-notes

  2. Bart Czernicki says:

    Posted an article that simplifies the steps, by not having to mess with changing/deleting assemblies, web.config.  Plus using my way, you can change any ASP.NET MVC 3 application into "Azure ready".…/Step-by-step-instructions-to-deploy-ASPNET-MVC-3-to-Windows-Azure.aspx

Skip to main content