Switching on the cloud for Silverlight
description
Transcript of Switching on the cloud for Silverlight
![Page 1: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/1.jpg)
Switching on the cloud for Silverlight
MSDN Live Meeting27-06-2011
Gill CleerenMicrosoft Regional Director – Silverlight MVPOrdina Belgium
![Page 2: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/2.jpg)
About myself...• Gill Cleeren• Microsoft Regional Director• MVP ASP.NET• .NET Architect @Ordina (www.ordina.be) • Speaker (TechDays, DevDays, NDC Norway,
Spring Conference UK, SQL Server Saturday Switzerland, TechEd Berlin, SDC...)
• Visug user group lead (www.visug.be)• Author (Silverlight 4 Data and services cookbook)• Blog: www.snowball.be• Email: [email protected] • Twitter: @gillcleeren
![Page 3: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/3.jpg)
Agenda• What is Windows Azure?
– Parts of Windows Azure– Why does a Silverlight developer need to care?– Developing for Windows Azure
• Required tools• Emulators (“local cloud”)• Azure Portal
• Moving Silverlight applications to the cloud– Database only– WCF
• What with REST– Entire Silverlight applications– RIA Services– Azure as intermediate layer for Twitter
![Page 4: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/4.jpg)
Agenda (2)• Using blob storage– Accessing files in blob storage– XAP hosted in blob storage
• (optional) Windows Phone 7 and Azure– Accessing services in the cloud
![Page 5: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/5.jpg)
WHAT IS WINDOWS AZURE?
![Page 6: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/6.jpg)
What is a Cloud Platform ?
"The concept, quite simply, is that vast computing resources will reside somewhere out there in the ether (rather than in your computer room) and we'll connect to them and use them as needed." Jonathan Weber (The Times Online)
![Page 7: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/7.jpg)
So, Windows Azure then?• An operating system for the cloud• Internet Scale• Microsoft data centers • Based on internet standards (Interopability)• Features– Service Management / Scalability– Compute power– Storage
• Familiar tools for development
![Page 8: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/8.jpg)
Windows AzureCloud Operating System:More value than what you think of with the term “OS” however!
Virtual NetworkComput
e Storage
Run code in the cloud
Scalable storage for files
Connect cloud with on-premise
![Page 9: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/9.jpg)
Microsoft is committed to the cloud!
Software-as-a-Serviceconsume
“SaaS”Platform-as-a-Service
build“PaaS”
Infrastructure-as-a-Servicehost
“IaaS”
Abstraction
![Page 10: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/10.jpg)
Cloud Services
Packaged Software
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
You
man
age
Infrastructure
(as a Service)
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
Managed by vendor
You
man
age
Platform(as a
Service)
Managed by vendor
You
man
age
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
Software(as a
Service)
Managed by vendor
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
Although the abstraction is raised, developers still need to know what happens behind the scenes!
![Page 11: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/11.jpg)
Parts of Windows Azure• Hosted services–Web role• IIS in the cloud• For running ASP.NET applications
–Worker role• Run any executable in the cloud (own
database, server...)
![Page 12: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/12.jpg)
Parts of Windows Azure (2)• Azure storage– Scalable storage in the cloud– 100TB per storage account– Auto-scale to meet massive volume and
throughput– Accessible via RESTful Web Service API• Access from Windows Azure Compute• Access from anywhere via internet• Supporting .NET Client Library
![Page 13: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/13.jpg)
Parts of Windows Azure (3)• Azure storage– Blob storage– Table storage– Queue storage
![Page 14: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/14.jpg)
Parts of Windows Azure (4)• SQL Azure– Familiar SQL Server relational database
model delivered as a service• Highly available
– Contains:• Database• Reporting• Data sync
![Page 15: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/15.jpg)
Parts of Windows Azure (5)• AppFabric– Access control– Service bus– Caching
![Page 16: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/16.jpg)
Why does a Silverlight developer need to care?• Azure targets web applications• Highly available• Easy scaling–May not be important for XAP– Important for services and database
![Page 17: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/17.jpg)
Developing for Windows Azure• Required tools– Visual Studio (duh)– Azure SDK– Azure Tools
Installs Compute emulatorStorage emulator
• Account on Windows Azure
![Page 18: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/18.jpg)
Management portal
![Page 19: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/19.jpg)
MOVING SILVERLIGHT APPLICATIONS TO THE CLOUD
![Page 20: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/20.jpg)
Let’s move!• Silverlight applications can be
“moved” to Azure on different levels– Database only–WCF/ASMX/REST services– All-in: Move the hosting site• XAP in webrole• XAP in blob storage
– RIA Services
![Page 21: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/21.jpg)
Hosting site
Scenario
Silverlight application
Service layer (WCF, REST...) Database
![Page 22: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/22.jpg)
CASE 1: DATABASE ONLY
![Page 23: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/23.jpg)
Hosting site
Scenario
Silverlight application
Service layer (WCF, REST...) Database
![Page 24: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/24.jpg)
Database only• Case:– A Silverlight business app–WCF services to expose the data– Data in a SQL Server 2008 database
• Task: move database only to the cloud
![Page 25: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/25.jpg)
Database only• Steps:– Create database on SQL Azure– Use Migration wizard to export database
to Azure– Change connection strings in service
configuration
![Page 26: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/26.jpg)
DEMODatabase only
![Page 27: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/27.jpg)
CASE 2: WCF SERVICE
![Page 28: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/28.jpg)
Hosting site
Scenario
Silverlight application
Service layer (WCF, REST...) Database
![Page 29: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/29.jpg)
WCF service • Case:– Silverlight business application
communicates with WCF service, service exposes data
– Data is migrated to SQL Azure• Task: move WCF service to Azure
![Page 30: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/30.jpg)
Side information• Silverlight can communicate with – ASMX– WCF (using BasicHttpBinding)
• Both expose a WSDL file– Used by Visual Studio to generate proxy class– Generates config containing service location
in Silverlight applicationPossible to
move existing service “use” cloud services inside VS Silverlight
project
![Page 31: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/31.jpg)
Silverlight and WCF service • Steps:– Create Cloud project– Add webrole to contain service hosting
site (ASP or WCF)– Test in compute emulator– Update Silverlight configuration to use
new service address– Deploy service package to the cloud– Re-deploy new Silverlight application
![Page 32: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/32.jpg)
DEMOSilverlight and WCF service
![Page 33: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/33.jpg)
REST service• Case:– Silverlight business application
communicates with REST service, service exposes data• A WCF service can be configured to work as
a REST service– Data is migrated to SQL Azure
• Task: move REST service to Azure
![Page 34: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/34.jpg)
Side information• REST (REpresentational State Transfer)– Protocol based on web standards (GET, PUT...)– All information is a resource– Information exchanged over XML or JSON
• Using WCF, we can create REST services– Silverlight sends request to URL– Service responds with XML– Silverlight can parse the XML
Possible to move the REST service to Azure
![Page 35: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/35.jpg)
Silverlight and REST service • Steps:– Create Cloud solution– Move service hosting site to webrole (ASP or
WCF)– Test in compute emulator– Update Silverlight configuration to use new
service address– Deploy service package to the cloud– Re-deploy new Silverlight application(Yes, this is identical!)
![Page 36: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/36.jpg)
DEMOREST service
![Page 37: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/37.jpg)
CASE 3: MOVE SILVERLIGHT TO THE CLOUD
![Page 38: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/38.jpg)
Hosting site
Scenario
Silverlight application
Service layer (WCF, REST...) Database
![Page 39: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/39.jpg)
Move Silverlight to the cloud• Case:– Database hosted in SQL Azure–WCF Service hosted in Windows Azure
(web role)– Silverlight application and hosting
website need to move to the cloud• Task: –Move Silverlight hosting site to (other)
web role
![Page 40: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/40.jpg)
Side information• Silverlight is just a XAP file, hosted
inside an HTML, ASPX, PHP... page• XAP file is downloaded from– Azure Hosted service– Azure Storage
• Site can be a web role
![Page 41: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/41.jpg)
Move Silverlight to the cloud• Steps:– Add second web role to cloud project OR
second cloud project (accessible via port number)
– (optional) Create a new hosted service for this role
![Page 42: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/42.jpg)
DEMOMove Silverlight to the cloud
![Page 43: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/43.jpg)
CASE 4: RIA SERVICES IN THE CLOUD
![Page 44: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/44.jpg)
RIA Services in the cloud• Case– Silverlight application that uses RIA
Services– Server-side use of Entity Framework– Database is moved to SQL Azure
• Task: – All-in approach: move everything to the
cloud
![Page 45: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/45.jpg)
Side information• RIA Services create a link between
server-side and client-side project• Hosting site requires configuration
changes and assembly references – RIA Services is not installed on your
Azure VM!• Specific template exists if starting
from scratch
![Page 46: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/46.jpg)
RIA Services in the cloud• Steps:– Add new web role to cloud project–Move service hosting site to webrole – Change configuration– Set Copy local to true for RIA Services
assemblies– Deploy Silverlight XAP along with
services• Services can be in a different assembly, will
be hosted alongside
![Page 47: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/47.jpg)
DEMORIA Services in the cloud
![Page 48: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/48.jpg)
CASE 5: USE AZURE AS TWITTER INTERMEDIATE
![Page 49: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/49.jpg)
Scenario
Silverlight Twitter
SERVICE
![Page 50: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/50.jpg)
Use Azure as Twitter intermediate
• Case–We want to use Twitter API in in-browser
Silverlight apps• Need to build intermediate service layer
• Task:– Use Windows Azure for this purpose
![Page 51: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/51.jpg)
Side information• Twitter doesn’t expose a policy file• In-browser Silverlight apps need this
file to access the service Intermediate service layer is required
![Page 52: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/52.jpg)
DEMOUse Azure as Twitter intermediate
![Page 53: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/53.jpg)
USING BLOB STORAGE
![Page 54: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/54.jpg)
Blob storage• Blobs can be used to– Store images and videos used in
Silverlight application• Possible to generate build a service that
allows access for a limited time to a resource (Shared Access Signatures)
![Page 55: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/55.jpg)
Blob storage• Blobs can be used to• Store XAP of Silverlight applicationWhy?
– Azure does not support updating just the XAP file (you can work around it using the VM Role)
– Easy versioning of just the Silverlight applicationThings to keep in mind
– The MIME type needs to be set to application/x-silverlight-app
– Cross-domain issues in 2 ways!» XAP hosted in blob storage, service on your domain» “Regular” cross-domain issues
![Page 56: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/56.jpg)
DEMOUsing Blog Storage
![Page 57: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/57.jpg)
DEMOThe XAP in blob storage
![Page 58: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/58.jpg)
WINDOWS PHONE AND AZURE
![Page 59: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/59.jpg)
Hello? Windows Phone• Windows Phone == Silverlight API
Most things we looked at work for WP7 as well
• Different models meet– Phone = not always connected– Cloud = there when you need it
• 2 options– Phone “calls” cloud– Cloud “calls” phone• Push notifications
![Page 60: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/60.jpg)
Phone “calls” cloud• These things just work–WCF/ASMX/REST service hosted in Azure• HTTP-based communication
– Database behind service in SQL Azure–WCF Data Services (oData)– XML/JSON/SOAP • Remember: the smaller the data, the better!
• Note: No cross-domain policy file required!
![Page 61: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/61.jpg)
Phone “calls” cloud• WP7 can not work with– RIA Services– Sockets– Duplex bindings
![Page 62: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/62.jpg)
DEMOWP7 and WCF Data Services in the cloud
![Page 63: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/63.jpg)
Summary• Silverlight apps work in harmony with
Azure– Database– Service layer– Silverlight app
• Blob storage is useful– For resources– For XAP hosting
![Page 64: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/64.jpg)
Q&A
![Page 65: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/65.jpg)
THANK YOU
![Page 66: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/66.jpg)
Stay up to date with MSDN Belux• Register for our newsletters and stay up to date:
http://www.msdn-newsletters.be– Technical updates– Event announcements and registration– Top downloads
• Follow our bloghttp://blogs.msdn.com/belux
• Join us on Facebookhttp://www.facebook.com/msdnbehttp://www.facebook.com/msdnbelux
• LinkedIn: http://linkd.in/msdnbelux/ • Twitter: @msdnbelux
Download MSDN/TechNet Desktop Gadget
http://bit.ly/msdntngadget
![Page 67: Switching on the cloud for Silverlight](https://reader035.fdocuments.us/reader035/viewer/2022070500/568168f5550346895de0025d/html5/thumbnails/67.jpg)
Switching on the cloud for Silverlight
MSDN Live Meeting27-06-2011
Gill CleerenMicrosoft Regional Director – Silverlight MVPOrdina Belgium