Now, let's break down the solution that was just created.
The first project in the solution is the HelloAzure project,
this is made up of:
Roles Directory - Contains a list of the Roles included in the
solution. If there were a worker role another role file would be in the
directory called HelloAzure_WorkerRole.
Roles\HelloAzure_WebRole - Ties HelloAzure to the
ServiceConfiguration.cscfg - Sets the configuration settings for
the project (If you are using table, blog or queue storage)
ServiceDefinition.csdef - This file defines the settings used in
the .cscfg file.
This project is the main project with the hooks to Azure.
When you publish this project it creates the files that need to be uploaded to
Azure for deployment.
The next project in the solution is the HelloAzure_WebRole.
This is where the web user interface will reside.
Now, we want to actually do something in Azure. Like I said
before, this is going to be very basic; something to just get you acclimated to
the Azure environment.
Open up default.asp to get started. We'll need two controls
for the purposes of this demo, a Label and a Button.
<asp:Label id="lblMessage" runat="server" text="" /><br />
<asp:Button id="btnSubmit" runat="server" text="Submit" />
Simple enough, now let us add a little functionality to the
First, when you get into the code behind, notice the
references at the top, in VB you'll have the following:
Now let us take a look at the click subroutine.
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim dt as DateTime = Now
Dim sb As New StringBuilder("Hello, Azure, the Date is ")
sb.Append(" and the time is ")
lblMessage.Text = sb.ToString
I used a string builder to look cool, but it really is
overkill for what I am trying to accomplish.
We can now run this in the development fabric by hitting F5.
After it builds and starts the development fabric you are
presented with a button called submit. Due to the fact that we are all super
intuitive and are compelled to click buttons called submit, click the button.
You will then see, something like:
Click it again, it updates, simple. Looks like a regular,
normal ASP.Net website. That is the goal though, to host applications in the
The challenges of Azure come into being when you start
working with Web Services and the storage mediums.
I'll enumerate some of the issues that my co-workers and I
have run into at the end of the article. What needs to be remembered is that
Azure is in CTP. The issues we've run into this week may not be their next
week, so take all criticism for what it is intended, to expose current issues
that need worked on by the Azure team, not bashing of the technology.