If you haven’t already, read the article this example is based on or start at the beginning of this example.
In the article, I create three separate services projects. Now that Azure supports multiple web applications in a single web role, I am going to only create one service project for the whole solution here. While prototyping each use case, I’ll deploy one Visual Studio project at a time to the cloud to verify that it works – then I’ll delete the deployment to avoid charges. Once I know they are all working, I’ll combine them into a single deployment.
In the Windows Azure account portal, select “Hosted Services, Storage Account & CDN” and then click “New Storage Account” on the toolbar. Choose the subscription that you are using (the specific way you signed up for Azure – if you signed up multiple ways, you will see multiple subscriptions). Enter a unique URL to identify your storage account and choose the closest region or – better yet – create an affinity group for your closest region from the dropdown list and select that affinity group:
Select the Hosted Services folder and click “New Hosted Service” on the toolbar. Choose a subscription, name your service, enter a unique URL, and choose the affinity group you created in the last step (ensures that storage and services are physically close together). Select “Do not deploy” here (I’d rather deploy from Visual Studio):
Return to Visual Studio (you’ll need to run as administrator before you can F5 this step) and add a Windows Azure Project called CSSService (again, this is a deviation from the article – I’m going to share the same service across all three use cases here instead of having three separate services):
Don’t add any new web roles to the solution on this step:
Right-click on the Roles folder and Add | Web role project in solution:
Select CSSAdmin from the ensuing dialog:
Compile and run the application to verify that it works in the development fabric.
Right-click on the CSSService project and select Publish. Before you can deploy from Visual Studio, you’ll need to add some credentials, so choose Add from the Credentials dropdown and follow the directions on the ensuing dialog:
Choose your credentials, the deployment environment (staging or production – for prototyping, I prefer to use production), and your storage account:
It can take a few minutes to complete productions … at the bottom of the dialog above, notice the checkbox for enabling IntelliTrace and configuring Remote Desktop. These can be very useful for diagnosing problems with your deployments. There are some caveats with setting these up, so for now, don’t use them – I will cover them in a later post.
Once the deployment process completes, browse to the <yoururl>.cloudapp.net to see your new app in production:
While prototyping, once you have verified that your app works, stop AND DELETE the web role so that you don’t incur charges.