MIX11 - Session Review - Building Windows Phone 7 Applications with the Windows Azure Platform
Wade Wegner ( Technical Evangelist @ Windows Azure Team )
Why Phone + Cloud?
- The cloud levels the playing field
- The cloud provides larger pool of resources from which to pull
- The cloud provides a way to reach across device platforms
Why Windows Phone 7 and Windows Azure?
- Because Windows Azure is PaaS. you build, Windows Azure runs it
- Automatic OS patching
- Scalable
- Utility billing model
-
Additional services
- Access Control Services (Provides Identity Federations)
- Traffic Manager (Provides an easy way to manage the location from which Data Center the app is served)
- Caching ( Provides a Caching Service that allows us to easily create cache in our apps)
- CDN (Content Delivery Network)
- …
-
Common Development tools
- Visual Studio
- Languages
- Emulators for development
- Demo Source Code: http://www.wadewegner.com/
What was shown in the Demo
-
Identity
-
Identity Options
-
Create your own (eg. username + password, token,
…)
- Custom Model
- ASP.NET Membership Providers
- Use a single existing identity system (eg. Live Id, Facebook, Twitter, …)
- Outsource identity management (eg. Access Control Service)
-
More information about this:
- Authenticating Users in a Windows Phone 7 App via ACS, OData and Windows Azure - http://bit.ly/wp7acs
-
Create your own (eg. username + password, token,
…)
-
Identity Options
-
Storage
-
Storage Options
-
SQL Azure
- Relational Database
- Highly available
- Managed for you as a Service
-
Pattern
-
WebRole that exposes an OData Service
- Create a Web role with an OData Service that will expose your SQL Azure data to your clients
-
WebRole that exposes an OData Service
-
Windows Azure Tables
- Non-relational structured Storage
- Massive scale-out
- OData
-
Pattern
-
Using Public Blobs
- Client sends data to the Web Role
- Web Role stores data in blobs
- Client fetches public blobs directly
-
Shared Access Signatures (SAS)
- Client gets Shared Access Signature from the Web Role
- Client inserts the SAS in the URI and stores data in blobs
- Client fetches public blobs and even private containers as long as the SAS allows it
-
Using Public Blobs
-
Windows Azure Blobs
- Big files
- REST
-
Pattern:
-
Proxy Calls
- Client sends data to the Web role
- Web role stores data in Blobs
-
Proxy Calls
-
SQL Azure
-
Storage Options
-
Services
- Web Role vs Worker Role
- Web Role has IIS
-
Worker role does not
- think about it as being a DLL with a Main()
- Both implement the RoleEntryPoint
-
Scaling Work in Windows Azure
-
Traditionally
- Web role receives message
- Web role enqueues work
- Worker role pools queue
- Worker role sends notifications
- Interesting because it splits the IIS and Services parts allowing you to scale them independently
-
Traditionally
-
Multitenancy
- You can have more than one application running in your role instance
- based on the Sites tag in the ServiceDefinition.csdef
-
Content Delivery Network (CDN)
- Currently at least 24 nodes that will cache data locally in order to provide the data faster
-
Traffic Manager
- Intelligently routes the request to the most appropriate Data Center according to the policies defined in it
-
Communications
-
Two primary communication models
-
Phone-initiated
-
Options
- Http-based, request/response
- Can be based on pooling of User Initiated requests
- Frameworks choises (WCF, OData, WebRequest, …)
- Wire Formats (SOAP, JSON, POX, …)
-
Options
-
Cloud-initiated
-
Push Notifications
-
Single connection between phone and
Microsoft Push Notification Service
- The cloud cannot connect directly to the phone, just passing by the Microsoft Push Notification
- There’s no warranty of delivery
- Bandwidth and battery friendly
-
Single connection between phone and
Microsoft Push Notification Service
-
There kinds of push notifications
- Raw – send a message to an app
-
Toast – send a message to the user
- Blue bar at the top
- Tile – Update an image, title or count
-
How does this works?
- Phone opens a channel in the Microsoft Push Notifications Service
- Phone sends the URL to the cloud
- Cloud pushes notifications via URL
- Microsoft Push Notification Service notifies the phone
-
Push Notifications
-
Phone-initiated
-
Two primary communication models
Important Best Practice: DO NOT STORE SECRETS ON YOUR PHONE
What is there to make this easier?
- Announcing: Windows Azure Toolkit for Windows Phone 7 (v1.1.0)
- Make it easier for phone developers to use Windows Azure
-
Toolkit includes:
- Client libraries
- Sample apps
- Source code
- Documentations
- Available on http://watoolkitwp7.codeplex.com
-
The phone will only communicate with a Service over HTTPs
if
- The cert is installed on the device
- The cert is signed by a Trusted Authority
- In order to use the self signed certs you need to install it on the phone