Launch Visual Studio 2010.
Select FileàNew Project… from
Visual Studio's menu.
Expand the Visual C# templates and click on the Cloud node. You should
see the Windows Azure Cloud Service template.
Change the name of the project to "ASPAllianceSample" and
click the OK button.
The "New Cloud Service" dialog box should appear.
Click on the ASP.NET Web Role in the left pane and click the > arrow
to move it to the right pane. This allows you to create a traditional ASP.NET
web site for the cloud. You can create a MVC web site, WCF service, background
process or GCI application but for this example we'll stick with the
traditional ASP.NET web site.
Click the OK button.
Visual Studio will add a whole bunch of standard files for a typical
ASP.NET application. Some of these files include a master page, the login and
password management pages, a style script, an about page, and a scripts
Click the run button to start the project. You should get the following
remedy this you need to close Visual Studio and then launch Visual Studio again
as an administrator. You can do this by clicking on StartàAll ProgramsàMicrosoft Visual Studio 2010 and then right click on
Microsoft Visual Studio 2010. Select "Run as administrator" from the
pop-up menu. Now you need to open the ASPAllianceSample project again.
try running the project again. If you don't have SQL Express installed you'll
get the following message.
Output window will give you a more descriptive message.
"Windows Azure Tools: Failed to initialize Development Storage service. Unable to
start Development Storage. Failed to start Development Storage: the SQL Server
instance ‘localhost\SQLExpress’ could not be found. Please configure the SQL
Server instance for Development Storage using the ‘DSInit’ utility in the Windows
fix this open the Windows Azure SDK Command Prompt. This is found at StartàWindows Azure SDK v1.2àWindow Azure SDK Command Prompt.
the following in the command window.
should see the following dialog.
the OK button and then run the project again. You should see the following web
the browser to stop debugging. Now we'll add a GridView control to the default
page that displays the records in the Person table in our database in the
the Default.aspx page in design mode and drag a GridView control from the
toolbox to anywhere on the page.
the GridView is dropped on the page the GridView Task window should appear
which allows you to configure the control. Select <New data source…>
from the "Choose Data Source:" drop down list. The "Data Source
Configuration Wizard" will appear.
"SQL Database" from the list of sources and change the ID to
the OK button. The "Configure Data Source" window will appear.
the "New Connection" button. This will display the "Add
server name should be the server name where your cloud database is located. To
figure this out you can go back to the Database Manager. To do this open your
browser and navigate to http://windows.azure.com.
You need to log into your account and then click on the "Database"
icon on the left pane in the dashboard.
"Subscriptions" should appear on the left hand side of your screen.
Expand your subscription. This will display your servers. Expand your servers
and you should see the "SampleDB". Click on this node and then click
the "Manage" icon in the toolbar.
Database Manager will appear and your server name is displayed in the
"Server" input box. Copy this value and go back to Visual Studio to
enter this name in the Connection server name.
the authentication type to "Use SQL Authentication" and enter the
user name and password you created when you created the database.
the database to SampleDB by selecting it from the list in the "Connect to
a database" section.
you click the "Test Connection" button you should get a "Test
connection succeeded" message if you've entered the correct information.
click the OK button. This will bring you back to the "Configure Data
the "Next" button.
the box checked that says "Do you want to save the connection in the
application configuration file?" Click the "Next" button.
next screen allows you to specify the table and the fields you want to select
from the database. The "Person" table should appear in the list of
tables or views. This table should already be selected but if it isn't you
should select it.
ID, FirstName, LastName, and Email fields should be listed in the columns list.
Leave the "*" selected so all the fields are returned.
the "Next" button.
next screen allows you to test your query. If you click the "Test
Query" button you should see the data in your table.
the "Finish" button.
the application again and you should see the Default page with the data from
Now that you have that working we can deploy this to the
cloud. You don't have to deploy it to the cloud. You can just stop here and
deploy it to your local production servers and leave the database hosted in the
cloud but for those of you interested in how to deploy the application to the
cloud read on.