Working with Multiple Web and Worker Roles

After you install the July 2009 CTP and create a new project via File | New Project | Cloud Service, you now have a single template “Cloud Service” instead of the 4 you had in the past.

Clicking on that brings up our new project creation dialog. 

image

There are a couple of reasons we have this dialog:

  1. In the past, we only allowed you to have 0 or 1 Web Roles and 0 or 1 Worker roles in your Cloud Service.  Now you can have 0 to N of either type.  We want to help you create the Service Model you want to have.
  2. We want to expose multiple templates for you to use for each of the Roles.  For example, we’re working to one day have an MVC Web Role, Dynamic Data Web Role and more.  We not only want you to create the Service Model you want to have but also using a selection of different templates for each Role.

You can add Web and Worker Roles to the Cloud Service solution, rename the projects and hit OK to create the Cloud Service.  Try adding 2 Web Roles and 2 Worker Roles.

image

You’ll have a solution that matches:

image

Note that you’ll want to setup the port numbers for your input endpoints in the ServiceDefinition.csdef. 

We auto-generate what we hope to be safe numbers but don’t know what your intention is for each of the Web Roles – at this point in time, a second or third Web Role cannot be assigned to a sub domain, they can only be differentiated by port.

When you hit F5, we’ll bring up a web browser instance for each of the Web Roles. 

If you don’t want us to bring up a Web Browser instance for a given web role, right click on the associated Role under the Roles node and deselect “Launch Browser”.

image

Also note that when you close one web browser, your debugging session will end.