Before you we can play around with Azure we need to install a few things. Note: These instructions work for Visual Studio 2010 RC on Windows 7.
Download and install Windows Azure platform AppFabric SDK V1.0
http://www.microsoft.com/downloads/details.aspx?FamilyID=39856a03-1490-4283-908f-c8bf0bfad8a5&displaylang=en
Setup IIS for ASP.Net
To enable IIS 7.0 with ASP.NET on Windows 7
1. Click the Start button, click Settings, click Control Panel, click Programs, and then click Programs and Features.
2. Click Turn Windows Features On or Off.
3. Under Internet Information Services, expand World Wide Web Services.
4. Under Application Development Features, click ASP.NET.
5. Under Common HTTP Features, click Static Content.
6. Install the selected features.
http://msdn.microsoft.com/en-us/library/dd179419.aspx
If you don't have SQL Express installed:
open the Windows Azure SDK Command Prompt:
And enter the following text:
dsinit /sqlinstance:.
The ?dot? represents the default SQL Server instance and may optionally be replaced with any valid instance name.
Next lets open visual studio as administrator. Select File - New ? Project. Select the cloud template and give the project a meaningful name like?MyFirstCloudService?.
Select Ok.
Next we need to select a role:
Let?s keep it simple and select an ASP.Net Web Role (we are indicating that we will be hosting a web site in the cloud).
Click the ?(pencil) icon to rename the Role to something meaningful ? ?MyFirstWebSiteRole? will do.
Select OK
Notice we have 2 projects
The MyFirstCloudService project contains all of our configuration information such as the size of our VM, the endpoint configurations, configuration settings and local storage. The second project, MyFirstWebRole, contains the asp.Net web site with a couple additions, 1) We have a file named WebRole.cs which is used to recycle the role instance if a configuration change is made and 2) notice we have several references to Microsoft.WindowsAzure.* which gives us access to the Azure APIs.
Before we run let?s add a multi-line textbox to the aspx page name Textbox1 and add the following code to the corresponding Page_Load event
Code Snippet
- protected void Page_Load(object sender, EventArgs e)
- {
- ????TextBox1.Text += "Running In Azure: " + RoleEnvironment.IsAvailable.ToString() + "\n";
- ????TextBox1.Text += "Deployment Id: " + RoleEnvironment.DeploymentId + "\n";
- ????TextBox1.Text += "Role Instance Id: " + RoleEnvironment.CurrentRoleInstance.Id + "\n";
- }
Press F5 and we will see our page with an output similar to this:
Notice when you started the app a little blue icon showed up in your systray.
This is the dev app fabric ? we are not actually running in the cloud yet!
Right click on the icon and select Show Development Fabric UI.
If we highlight some the various nodes on the left, we see how things in the Development Fabric line up with things on our ASPX page.
So what is a role?
A role is just another name for your app. It specifically refers to the base virtual machine image that hosts your app. In our case, a web role, we are talking about a VM that hosts your application within IIS.
What is the development fabric?
The development fabric simulates the Windows Azure fabric on your local computer so that you can run and test your service locally before deploying it. That is a lot of information for one post, we will go over the fabric, configuration, and actually deploying the service in another post (that will require an azure account and a credit card.
99d84dc6-f356-408e-8a51-589631c286c9|6|5.0