Deploying an ASP.NET Application in Windows Azure

2/11/2011 11:47:58 AM
You're almost there. In this section, you walk through the steps of deploying the ASP.NET application in the cloud:
  1. You need to publish your project. Right-click AzureExample, and click Publish. This action, upon success, opens two windows:

    • Windows Explorer. This window contains the two files you need to deploy in Windows Azure. You need this window soon, so don't close it.

    • Internet Explorer. The Windows Azure Portal is automatically shown as well, because you need to deploy the binaries there. You may be prompted to sign in first.

  2. When you've logged in, the Internet Explorer window shows you the home page for your Windows Azure projects. Click the Windows Azure project under which you previously created the AzureExample service.

  3. You should see the page shown in Figure 1 at this article. Click AzureExample, which should bring you to what you saw earlier in Figure 4.

  4. On the right side of the browser page is a vertical bar with a left-pointing triangle. Click the triangle to open a split page with both Production and Staging sections, as shown in Figure 1. Deploying in staging creates a temporary service that you can use to test before promoting to the final public URL. This way, you can test that your application is working as desired before deploying it.

    Figure 1. Viewing the production and staging environments
  5. Click the Deploy button under Staging. Doing so brings up a new page (see Figure 9-16) with the following fields:

    • Application Package. This is the package that Visual Studio built for you. It's the file with extension .cspkg in the Windows Explorer window. Clicking Browse opens an Open form. You may find it easier to copy the entire path from the Windows Explorer window and paste it in the Open form. Select the package file, and click Open.

    • Configuration Settings. This is the configuration file of your cloud service project with a .cscfg extension. Again, click Browse and select the configuration file from the Open form.

    • Operating System Settings. This section allows you to configure the specific version of the operating system you're using for this service. Leaving Upgrade Method set to Automatic ensures that you get the latest security patches and .NET upgrades automatically. You can also choose Manual and select the desired system.

    • Service Deployment Name. Under Service Deployment Name, you need to enter a label for your service. Type TEST001, for example.

    Figure 2. Windows Azure first-time deployment page
  6. When the information provided looks like Figure 2, click Deploy. Doing so first copies the appropriate files to the cloud and creates the virtual machine in which your project will be deployed (see Figure 3). After it's deployed, your service isn't be running just yet; however, you start incurring charges immediately.

    Figure 3. Deploying a package in staging

Your screen should now look like Figure 4. To start your virtual machine, click Run under Staging. This operation may take a few minutes. When the startup operation is completed, you see the status of your service as Ready. At this point, you can test your ASP.NET application in the cloud by clicking the Web Site URL link in Staging. Notice that this isn't the URL you originally requested—the public URL previously registered is reserved for production. Instead, staging is given a deployment GUID that's also part of the web site's URL. In this case, the URL for the staging environment is

Figure 4. Completed deployment of your service

Clicking the link opens another browser and runs your service in the cloud (see Figure 5).

Figure 5. Running the service in the cloud


As mentioned previously, you're now paying for this Windows Azure service. You must first suspend your service (by clicking Suspend) if it's running; however, that alone doesn't stop you from accruing charges. You must also click the Delete button under both your staging and production environments. On the same page is a Delete Service button; it releases your service altogether and doesn't affect how you're billed.

Now that the code has been tested in staging, go back to the service management page (shown earlier in Figure 4) and click the center icon () to promote your code to production. A confirmation message comes up. This operation swaps both environments (production and staging); you can expect to wait a few minutes while the swapping takes place. Once in production, the URL you registered previously works.

You may have noticed that you haven't changed any database settings between staging and production. Staging and production environments refer only to Windows Azure services, not the SQL Azure database running behind the scenes.

As a result all versions of your ASP.NET application (when run locally, in staging or in production) point to the same SQL Azure database by default, unless you specifically change your configuration settings in each environment (see Figure 6). You also need to make sure your firewall configuration is correctly set, or you may have a surprise when publishing your web application in the cloud.

Figure 6. Summary of deployment scenarios

  •  Windows Azure and ASP.NET : Creating a Windows Azure Project
  •  Windows Azure and ASP.NET : Creating a Windows Azure Service
  •  IIS 7.0 : Performance and Tuning - Processor
  •  IIS 7.0 : Striking a Balance Between Security and Performance - SSL
  •  IIS 7.0 : Striking a Balance Between Security and Performance - How to Measure Overhead
  •  Advanced ASP.NET : Component-Based Programming - The ObjectDataSource
  •  Advanced ASP.NET : Data-Access Components (part 3) - Enhancing the Component with Error Handling & Enhancing the Component with Aggregate Information
  •  Advanced ASP.NET : Data-Access Components (part 2) - Using the Data-Access Component
  •  Advanced ASP.NET : Data-Access Components (part 1) - A Simple Data-Access Component
  •  Advanced ASP.NET : Component-Based Programming - Properties and State
    PS4 game trailer XBox One game trailer
    WiiU game trailer 3ds game trailer
    Top 10 Video Game
    -   Anno 2025 - E3 2015 Intro Trailer
    -   Awesome GTA V Sniper Chopper Kill
    -   Awesome GTA V Parachute Video
    -   GTA V Explosive Ammo Rounds with Bikini
    -   Funny GTA V Road Rage Clip
    -   Cool GTA V Motorbike Jump
    -   When a Mouse Jacks Your Truck in GTA V
    -   Pig Riding a Motorbike in GTA V
    -   Using an Uzi While Driving in GTA V
    -   PlayStation 4 Ultimate Player 1TB Edition | Reveal Announcement
    -   Dreamfall Chapters Book Three: Realms [PC] Zoe Trailer
    -   Street Fighter V Trailer
    -   Beyond Flesh and Blood | Beetham Folly Gameplay 1
    -   Uncharted 4: A Thief's End | E3 2015 Gameplay Demo PS4
    -   World of Warcraft | Patch 6.2 Survival Guide
    Game of War | Kate Upton Commercial