So yesterday we saw the Mix10 Videos Silverlight Application discussed in a blog post, today we are going to go global with Windows Azure.

If you have absolutely no idea what I am talking about with regards to Azure, perhaps you think I am talking about the colour Azure, well head on over to Microsoft to see what they mean by Azure.

For the 15 second elevator pitch it is ‘Microsoft’s Cloud Computing Platform for hosting application on a global scale and enabling you to ramp up to meet demand on a global scale without having to worry about your IT infrastructure.

As an interesting aside Wikipedia mentions Azure as being The word Azure is a near synonym for the color blue. Commonly it refers to a bright blue, resembling the sky on a bright, clear day, which I guess makes it rather aptly titled.

Anyway, lets get cracking with our Application in the Cloud shall we

We are going to convert the application we created yesterday to a Windows Azure application and deploy it to the cloud so lets get started.

Converting to a Cloud App

Below we have a screenshot of our application as it stands at the moment in Visual Studio 2010.


We now need to add the Cloud Configuration stuff to the solution which we do by adding a new project and selecting the Windows Azure Cloud Service template.


We are then taken to the New Cloud Service Project and have the option to Add new Roles. You can think of the Roles in this instance as the type of Applications you want to create. Although we already have our applications the Web Site project is not defined as a Web Application (this is required) so we will add a new ASP.NET Web Role.


You can see below that we now have a new Azure Configuration project added to our solution containing a Role called MediaPlayerHost which is our new project that we have added (or Role in Azure lingo).

I did a bit of cleaning up, removed our old Silverlight host application and linked the new MediaPlayerHost application to the Silverlight project.

Looking at the Configuration for our MediaPlayerHost role you can see some settings that will control how our app is configured in the Cloud. Our VM size is set to small and our instance count is set to 1. For the purposes of our Development Environment we are going to set that count to 2 so you can see what is going on.


Local Debugging of an Azure application

We would like to be able to test our application thoroughly before we deploy it to the Cloud and we can do that from within our local copy of Visual Studio 2010.

Couple of gotchas to look out for are the StartUp project and the Development Storage Database instance.

  1. Make sure that your solution startup project settings are pointing to your Cloud Configuration project as shown below:

Startup Project Settings

  1. If you have not installed SQLExpress (like me) and prefer to work with SQL Developer Edition you will need to point Azure Development Storage Service to your instance of SQL Server. You can do this by running Windows Azure SDK Command Prompt (found at Windows Azure SDK 1.1 under Start|All Programs) and enter the command shown:

Windows Azure SDK Command Prompt

Visual Studio 2010 provides us with a local test environment to simulate the Cloud right out of the box. No need to do anything special, just set your configuration and your good to go. One gotcha is your apps will take a little longer to start up when running them in the test environment so I hope you have a beefy spec dev box but lets be realistic here shall we folks, if your a developer for a living then you will want a decent spec machine unless you come from a long line of Russian Hackers and you like to make life difficult for yourself by writing all your code in notepad :-)

Lets start our application and see what we have shall we.

Running Application & Development Fabric UI

On the left hand side we can see our application running as normal. On the right hand side we have the Development Fabric UI which shows our 2 instances running.

Essentially this is simulating a load balancer in front of these 2 instances with the application being available on the default port of 80 on the localhost (

By delving a little deeper and opening the Local Store on each of the 0 and 1 instances shown running on the right hand side, navigating the file system down in to the Temp folder we can find the individual applicationHost.config files. Open them up and you will find a section as follows:

<sites><sitename="Role Site"id="1"><applicationpath="/"><virtualDirectorypath="/"physicalPath="D:\Dev\Samples\MediaPlayerAzure\AzureConfiguration\bin\Debug\AzureConfiguration.csx\roles\MediaPlayerHost\approot\"/>application><bindings><bindingprotocol="http"bindingInformation=""/>bindings><logFilelogExtFileFlags="Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus"logFormat="W3C"directory="C:\Users\Jamesey\AppData\Local\dftmp\s0\deployment(4)\res\deployment(4).AzureConfiguration.MediaPlayerHost.1\directory\DiagnosticStore\LogFiles"period="Hourly"/><traceFailedRequestsLoggingenabled="true"directory="C:\Users\Jamesey\AppData\Local\dftmp\s0\deployment(4)\res\deployment(4).AzureConfiguration.MediaPlayerHost.1\directory\DiagnosticStore\FailedReqLogFiles"maxLogFiles="1000"/>site><siteDefaults><logFilelogFormat="W3C"directory="%SystemDrive%\inetpub\logs\LogFiles"/><traceFailedRequestsLoggingdirectory="%SystemDrive%\inetpub\logs\FailedReqLogFiles"/>siteDefaults><applicationDefaultsapplicationPool="{22ACD959-DC0A-407B-83FE-B0B509D5A7E9}"/><virtualDirectoryDefaultsallowSubDirConfig="true"/>sites>

In my case the instances are running on and and opening a command prompt and running ‘netstat -na -p TCP’ shows both those ports being listened on.

Listening Ports

Deploying to the Cloud

Now that we have our Cloud application built we need to deploy it and for that you will need to sign up for a Windows Azure account. Assuming you have done so lets go through the steps to deploy the application.

  1. Sign in to your Azure Account.

  2. Select your default Project

  3. Select ‘New Service’ shown below

ÂNew Service

  1. Create a new Hosted Service as shown below.

Hosted Service

  1. Configure your Service Properties as shown below

Service Properties

  1. Give your application a host name and select where you would like to deploy the application. I will select Anywhere Asia as this is my region.

Hosted Service URL and Deployment Region

  1. Now Click Create and sit back for a few seconds whilst the service is created. When that is done the final step is to deploy the Host Service, in this case I will select Staging.

Deploy Hosted Service

  1. On the window that opens we need to select the package that is ready to deploy as shown below.

Deployment Packages

  1. Press Deploy and then we are ready to start our Application.

  2. But before we do you will notice that there is an image between Staging and Production. This is an active button we can press at any time to promote our application from Stage to Production.

Staging to Production

  1. Finally lets Start our application by pressing Run. This will take several minutes whilst VMs are built and our application is deployed to the VMs and the whole of the infrastructure is initialized.

  2. And Voila! We are ready for world domination.


So just like that I can develop an application (just need to find that million $ idea) and deploy it to a hosted service in the Cloud and be up and running globally and ready to ramp up when my idea takes off and all from the living room I like to call Visual Studio 2010.

Bloody Awesome I say!