Move an ASP.NET application to the cloud


 This is a step by step guide to move an existing ASP.NET Web Application to the Cloud.

  1.  Add a cloud service project to your existing solution
    1. Solution Explorer right click your solution and select ‘Add -> New project …’
    2. In the Add New Project dialog select Installed Templates –> Cloud -> Windows Azure Project template
    3. Choose name and press the OK button.
    4. Don’t add a role in the New Windows Azure dialog. The existing ASP.NET web application will be used as a web role.
  2. Associate the ASP.NET project to the cloud project
    1. Right click Windows Azure Project Role folder -> Add -> Web Role Project in solution ...
    2. In the Associate with Role Project dialog, select your web project and click OK.
  3. Add references to the required assemblies.
    1. Right click web application project and select add reference. Add references to the following assemblies:
      1. Microsoft.WindowsAzure.Diagnostics
      2. Microsoft.WindowsAzure.ServiceRuntime
      3. Microsoft.WindowsAzure.StorageClient
  4. Enable diagnostic logging by adding the following section to your Web.config.
    <system.diagnostics>
      <trace autoflush="false" indentsize="4">
            <listeners>
         
    <add name="AzureDiagnostics" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
       
    </listeners>
      
    </trace>
    </system.diagnostics>
  5. Modify Global.asax
    1. Set configuration settings publisher. Add the following code snippet to the Application_Start procedure:
      Microsoft.WindowsAzure.CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
      {
          configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
        }); 
      In addition to this, you have to add using statements for the following namespaces:
        
         using Microsoft.WindowsAzure;
         using Microsoft.WindowsAzure.ServiceRuntime;
  6. Deploy your solution to the cloud.

 


Skip to main content