Avkash Chauhan's Blog

Windows Azure, Windows 8, Cloud Computing, Big Data and Hadoop: All together at one place.. One problem, One solution at One time...

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

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

  • Comments 2

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: http://aspmvc3webroleazure.codeplex.com/

Step 1. Please create a MVC2 Web Role as below:


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


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

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


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


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


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

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

  • 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: http://aspmvc3webroleazure.codeplex.com/

Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post
Page 1 of 1 (2 items)