Overview

When Windows Azure was first released, there were a few, but significant restrictions in the programming model. Things like Full Trust, Administrative Access, and the full IIS feature-set were initially restricted for security reasons. This impacted the types of applications that could be created in Windows Azure because even small changes to things like configuration settings were often blocked by lack of administrative control over the VM Instances. Over time, those restrictions were lifted – first Full Trust, and now the ultimate control: Administrative access and Full IIS support.

With the latest SDK release, you can choose to run your web sites under IIS7, not in Hosted Web Core as in the past, but in full IIS. This means you can use all the facilities of IIS now like custom modules, multiple websites, VDIR support, application pool isolation, and more.

Additionally, you can now choose two different ways to exercise your administrative control. You can bootstrap the machine as an administrator using something called “Startup Tasks” shown in this lab. This temporarily raises your permissions to administrative and allows you perform small setups, update configuration settings, or other bootstrapping tasks. Once completed, your code will run as a normal, unprivileged user. The second method is that you can now configure your role to simply run as an administrator the entire time. In most cases, the Startup Tasks are the right choice as running your role with administrative permissions the entire time has security implications.

This lab introduces these new capabilities that are unlocked in Windows Azure and allow more advanced application scenarios.

Objectives

In this hands-on lab, you will learn how to:

  • Use advanced service model features that enable hosting a Web role in IIS.
  • Host multiple sites in a Web role and bind them to the same endpoint using host headers.
  • Create virtual applications and map them to selected sites.
  • Utilize user virtual directories to share common content between sites.
  • Set up the role environment by executing start-up tasks to register a COM.
  • Install complex components required by a web role, such as a scripting language's binary files.

Note:
This lab shows advanced features of Web and Worker roles in Windows Azure; it assumes that you have sufficient knowledge of Windows Azure. If you are beginner in Windows Azure, see the Introduction to Windows Azure lab in this training kit first.

Prerequisites

The following is required to complete this hands-on lab:

Setup

For convenience, much of the code used in this hands-on lab is available as Visual Studio code snippets. To check the prerequisites of the lab and install the code snippets:

  1. Open a Windows Explorer window and browse to the lab’s Source\Setup folder.
  2. Double-click the Dependencies.dep file in this folder to launch the Dependency Checker tool and install any missing prerequisites and the Visual Studio code snippets.
  3. If the User Account Control dialog is shown, confirm the action to proceed.

Note:
 This process may require elevation. The .dep extension is associated with the Dependency Checker tool during its installation. For additional information about the setup procedure and how to install the Dependency Checker tool, refer to the Setup.docx document in the Assets folder of the training kit.

Using the Code Snippets

Throughout the lab document, you will be instructed to insert code blocks. For your convenience, most of that code is provided as Visual Studio Code Snippets, which you can use from within Visual Studio 2010 to avoid having to add it manually.

If you are not familiar with the Visual Studio Code Snippets, and want to learn how to use them, you can refer to the Setup.docx document in the Assets folder of the training kit, which contains a section describing how to use them.

Exercises

This hands-on lab includes the following exercises:

  • Registering Sites, Applications, and Virtual Directories
  • Using Start-Up Tasks to Register a COM Component
  • Using Start-Up Tasks to Install PHP with the Web Platform Installer

Estimated time to complete this lab: 60 minutes.

Note:
When you first start Visual Studio, you must select one of the predefined settings collections. Every predefined collection is designed to match a particular development style and determines window layouts, editor behavior, IntelliSense code snippets, and dialog box options. The procedures in this lab describe the actions necessary to accomplish a given task in Visual Studio when using the General Development Settings collection. If you choose a different settings collection for your development environment, there may be differences in these procedures that you need to take into account.