Building the Infrastructure
Our code will be composed of many projectsIn order for a phone application to talk to the cloud to get data, it needs a few things setup. Here are the things that we are going to build:
![bullet bullet]()
|
A web service that hosts a SL-enabled WCF Service |
![bullet bullet]()
|
A Silverlight client for both a browser and a Windows Phone 7 |
![bullet bullet]()
|
A data tier to host our data |
![bullet bullet]()
|
A SQL Azure database and a SQL Server On-Premise database |
|
|
![image image]() |
Let’s start by creating a new "Blank Visual Studio Solution.” Remember that a solution can hold many projects.
![snap0001 snap0001]()
Step 1
Add a blank solutionSpecify a name that you will remember. I’m choosing “WcfInAzure.” |
|
![snap0002 copy[4] snap0002 copy[4]]()
Step 2
Start with the first ‘project.’ Let’s add a “Cloud Service” This will be an application that gets hosted in Windows Azure. In the meantime, it will be run on our local development fabric. |
|
![snap0003 copy[4] snap0003 copy[4]]()
Step 3
Add a “Windows Azure Cloud Service” I will call this project “TierWebWcfHost.” |
|
![snap0004 copy[4] snap0004 copy[4]]()
Step 4
We will create an ‘ASP.NET Web Role.” This will be the web site that hosts our ‘SL-enabled WCF Service.’ |
|
![snap0005 copy[6] snap0005 copy[6]]()
Step 5
Need to rename ‘WebRole1’ You don’t really need this screen, but I’m being super-complete in this tutorial. |
|
My Subject Goes Here
Subject HeaderThis is the string to replace |
|
![snap0006 copy[11] snap0006 copy[11]]()
Step 6
Rename ‘WebRole1’ Click the pencil in the red box. |
|
![snap0007 copy_thumb[3] snap0007 copy_thumb[3]]()
Step 7
Provide a more descriptive name (TierWebWcfHost_WebRole') Just type into the text box. |
|
![snap0008 copy_thumb[2] snap0008 copy_thumb[2]]()
Step 8
Verify our progressAt this point we have created a blank solution plus a single project called ‘TierWebWcfhost.’ We still have more projects to add. The only thing left that we might try is to run this project in the ‘local developer fabric,’ which is a simulation environment that mirrors how your app will run once you deploy to the cloud.Two projects are added for a cloud serviceNotice that when we added our ‘Windows Azure Cloud Service’ two projects were actually added. |
|
![snap0011 copy snap0011 copy]()
Step 9
Run our ‘Windows Azure Cloud Service’ Go to the ‘Debug’ menu and select ‘Start Debugging.’ |
|
![snap0013 copy[6] snap0013 copy[6]]()
Some code
Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TierWebWcfHost_WebRole._Default" %><asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"></asp:Content><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> To learn more about ASP.NET visit <a href="https://www.asp.net" title="ASP.NET Website">www.asp.net</a>. </p> <p> You can also find <a href="https://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409" title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>. </p></asp:Content>
|
Step 10
Our basic cloud application is workingNotice we are running at ‘https://127.0.0.1:81/” the project is running in the local developer fabric. |
|
![snap0015 copy snap0015 copy]()
Here is how you can see the local developer fabric running
![snap0016 copy snap0016 copy]()
One instance is running
Obviously, we are not running in the cloud yet. We are running in the local developer fabric.
![snap0017 copy snap0017 copy]()
More posts coming soon
Building the Windows Azure and Windows Phone 7One step at a time is how I roll. So stay tuned for more detailed steps. Keep the emails flowing and let me know what works and what doesn’t. I’m Bruno at bterkaly@microsoft.com |