Leverage Cloud Computing with Windows Azure and Windows Phone 7 – Step 2 to Infinity – Under Construction
[アーティクル]
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:
A web service that hosts a SL-enabled WCF Service
A Silverlight client for both a browser and a Windows Phone 7
A data tier to host our data
A SQL Azure database and a SQL Server On-Premise database
Let’s start by creating a new "Blank Visual Studio Solution.” Remember that a solution can hold many projects.
Step 1
Add a blank solutionSpecify a name that you will remember. I’m choosing “WcfInAzure.”
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.
Step 3
Add a “Windows Azure Cloud Service” I will call this project “TierWebWcfHost.”
Step 4
We will create an ‘ASP.NET Web Role.” This will be the web site that hosts our ‘SL-enabled WCF Service.’
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
Step 6
Rename ‘WebRole1’ Click the pencil in the red box.
Step 7
Provide a more descriptive name (TierWebWcfHost_WebRole') Just type into the text box.
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.
Step 9
Run our ‘Windows Azure Cloud Service’ Go to the ‘Debug’ menu and select ‘Start Debugging.’
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.
Here is how you can see the local developer fabric running
One instance is running
Obviously, we are not running in the cloud yet. We are running in the local developer fabric.
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