ebook img

Introduction to Windows Azure: an introduction to cloud computing using Microsoft Windows Azure PDF

354 Pages·2009·15.48 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Introduction to Windows Azure: an introduction to cloud computing using Microsoft Windows Azure

cYAn YeLLOW MAGenTA BLAcK PAnTOne 123 c BOOKs fOR PROfessIOnALs BY PROfessIOnALs® The eXPeRT’s VOIce® In .neT Companion eBook Available Introducing Windows Azure I n Dear Reader, t r Now is the time for you to learn the fundamentals of Windows Azure program- o ming, and this book gives you a first look at this exciting new cloud platform d Introducing from Microsoft. u Whenever a new technology is introduced, I find that the quickest way to get c ahead is to study code examples that demonstrate the core details of that tech- i Henry Li nology. So I have written Introducing Windows Azure to provide you with a rich n Windows set of example projects that cover the core skills you must learn to be a Windows g Azure developer. In this book I also provide you with plenty of tools and re-useable compo- W nents for Azure development, such as a tool to work with large amounts of data in cloud storage, and a tool to access SQL Azure services - which I found extreme- ly useful while writing this book. These tools will help not only your own Azure work, but also your understanding of the Azure platform. These practical appli- i cations give you all you need to dive straight into Azure development and write n Azure production-ready applications. I wrote this book to give you confidence and experience as a Windows Azure d developer. Most importantly, I wrote it so that you can get ready for the next big wave in our industry: cloud computing. I am sure that you will be as excited and impressed as I am with the many innovational features introduced by Windows o Azure after reading through this book. w Enjoy your Azure developing and happy reading. Henry Y.H. Li s A THE APRESS ROADMAP Learn Windows Azure to create next-generation, Introducing Companion eBook Windows Azure z cloud-based applications Pro Beginning C# Pro Silverlight 3 in C# Silverlight for the Enterprise u Illustrated WPF Pro Soene l$a1s0t peaBgoeo kfo vre drseitoanils Illustrated C# Azure Services Platform r Pro C# and the e .NET Platform Henry Li SOURCE CODE ONLINE www.apress.com ISBN 978-1-4302-2469-3 53999 US $39.99 Shelve in: Programming Languages / C# User level: 9 781430 224693 Intermediate this print for content only—size & color not accurate 7.5 x 9.25 spine = x.xxx" xxx page count cYAn YeLLOW MAGenTA BLAcK PAnTOne 123 c BOOKs fOR PROfessIOnALs BY PROfessIOnALs® The eXPeRT’s VOIce® In .neT Companion eBook Available Introducing Windows Azure I n Dear Reader, t r Now is the time for you to learn the fundamentals of Windows Azure program- o ming, and this book gives you a first look at this exciting new cloud platform d Introducing from Microsoft. u Whenever a new technology is introduced, I find that the quickest way to get c ahead is to study code examples that demonstrate the core details of that tech- i Henry Li nology. So I have written Introducing Windows Azure to provide you with a rich n Windows set of example projects that cover the core skills you must learn to be a Windows g Azure developer. In this book I also provide you with plenty of tools and re-useable compo- W nents for Azure development, such as a tool to work with large amounts of data in cloud storage, and a tool to access SQL Azure services - which I found extreme- ly useful while writing this book. These tools will help not only your own Azure work, but also your understanding of the Azure platform. These practical appli- i cations give you all you need to dive straight into Azure development and write n Azure production-ready applications. I wrote this book to give you confidence and experience as a Windows Azure d developer. Most importantly, I wrote it so that you can get ready for the next big wave in our industry: cloud computing. I am sure that you will be as excited and impressed as I am with the many innovational features introduced by Windows o Azure after reading through this book. w Enjoy your Azure developing and happy reading. Henry Y.H. Li s A THE APRESS ROADMAP Learn Windows Azure to create next-generation, Introducing Companion eBook Windows Azure z cloud-based applications Pro Beginning C# Pro Silverlight 3 in C# Silverlight for the Enterprise u Illustrated WPF Pro Soene l$a1s0t peaBgoeo kfo vre drseitoanils Illustrated C# Azure Services Platform r Pro C# and the e .NET Platform Henry Li SOURCE CODE ONLINE www.apress.com ISBN 978-1-4302-2469-3 53999 Li US $39.99 Shelve in: Programming Languages / C# User level: 9 781430 224693 Intermediate this print for content only—size & color not accurate 7.5 x 9.25 spine = x.xxx" xxx page count Introduction to Windows Azure An Introduction to Cloud Computing Using Microsoft Windows Azure (cid:132) (cid:132) (cid:132) Henry Li i Introduction to Windows Azure Copyright © 2009 by Henry Li All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2469-3 ISBN-13 (electronic): 978-1-4302-2470-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Matthew Moodie Technical Reviewer: Bing Long Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Anita Castro Copy Editor: Hastings Hart Compositor: Tricia Bronkella Indexer: Potomac Indexers Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer- sbm.com, or visit http://www.springeronline.com. For information on translations, please e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. ii This book is dedicated to my dear father, math Professor Rondong Li, who is always my source of spiritual encouragement, and my mother, who was my first math teacher at primary school. iii Contents at a Glance ■ Contents ............................................................................................................................ v ■ Foreword ........................................................................................................................... x ■ About the Author ............................................................................................................ xiii ■ About the Technical Reviewer ........................................................................................ xiv ■ Acknowledgments ........................................................................................................... xv ■ Introduction .................................................................................................................... xvi ■ Chapter 1: Create Cloud Table Storage .............................................................................. 1 ■ Chapter 2: Access Cloud Table Storage ........................................................................... 25 ■ Chapter 3: Working with Cloud Queue and Blob Storage ................................................ 67 ■ Chapter 4: Windows Azure Application Integration Using WCF ..................................... 113 ■ Chapter 5: Azure .NET Services—Access Control ......................................................... 129 ■ Chapter 6: Azure .NET Services— Service Bus ............................................................. 171 ■ Chapter 7: Azure .NET Services—Workflows ................................................................ 211 ■ Chapter 8: SQL Azure .................................................................................................... 243 ■ Chapter 9: Deploy Applications and Production Maintenance ...................................... 297 ■ Appendix ....................................................................................................................... 313 ■ Index ............................................................................................................................. 315 iv ■ CONTENTS Contents ■ Foreword ........................................................................................................................... x ■ About the Author ............................................................................................................ xiii ■ About the Technical Reviewer ........................................................................................ xiv ■ Acknowledgments ........................................................................................................... xv ■ Introduction .................................................................................................................... xvi Windows Azure Essentials .......................................................................................................................... xvi Web Role ............................................................................................................................................... xix Worker Role ........................................................................................................................................... xix Azure Fabric .......................................................................................................................................... xix Who This Book Is For ................................................................................................................................... xx Prerequisites .............................................................................................................................................. xxi How This Book Is Structured ...................................................................................................................... xxii Chapter 1: Create Cloud Table Storage .................................................................................................. xxii Chapter 2: Access Cloud Table Storage ................................................................................................ xxiii Chapter 3: Working with Cloud Queue and Blob Storage ...................................................................... xxiii Chapter 4: Windows Azure Application Integration Using WCF .............................................................. xxiii Chapter 5: Windows Azure .NET Services—Access Control .................................................................. xxiii Chapter 6: Windows Azure .NET Services—Service Bus ...................................................................... xxiii Chapter 7: Windows Azure .NET Services—Workflows ........................................................................ xxiv Chapter 8: SQL Azure ........................................................................................................................... xxiv Chapter 9: Deploy Windows Azure Applications to Production .............................................................. xxiv Appendix A: Resources ........................................................................................................................ xxiv Downloading the Code ......................................................................................................................... xxiv Contacting the Author ................................................................................................................................ xxv ■ Chapter 1: Create Cloud Table Storage .............................................................................. 1 The Table Storage Specification .................................................................................................................... 2 A Closer Look at Entities ............................................................................................................................... 3 v ■ CONTENTS Azure Development Storage .......................................................................................................................... 4 Create Cloud Data Storage with a Simple Data Structure ............................................................................... 5 Using Portable Data Types for Data Columns .......................................................................................... 15 Using Data Tables Generated by Windows Azure Development Tool ....................................................... 15 Solutions to Non-Portable Data Types .................................................................................................... 15 Data Context Class Inheritance .............................................................................................................. 17 Using PartitionKey and RowKey to Organize the Data to be Distributed ................................................... 18 Create Cloud Data Storage with Relational Data Structure ........................................................................... 19 A Constraint for Data Entity Classes Contains Embedded Entity Classes ................................................. 21 Refactoring Data Entity Classes .............................................................................................................. 22 Close SQL Analysis ................................................................................................................................ 23 Summary .................................................................................................................................................... 23 ■ Chapter 2: Access Cloud Table Storage ........................................................................... 25 Accessing a Single Cloud Data Storage Table ............................................................................................. 25 Data Entity Class Constructors ............................................................................................................... 41 Table Storage Keys ................................................................................................................................ 42 Log Runtime Message and Event Information for Debugging .................................................................. 42 Leverage the Power of Development Fabric Services ............................................................................. 43 Using Fiddler 2 to Debug Cloud Storage Applications ............................................................................. 43 Leverage LINQ to Query Entities in Cloud Storage ................................................................................... 45 Using HTTP REST to Query the Top N Entities ......................................................................................... 46 Using Continuation Tokens to Retrieve Paginated Data ........................................................................... 46 Deleting and Updating an Entity in a Single Cloud Data Storage Table ......................................................... 48 Update Data Tables in Buckets .............................................................................................................. 59 Best Practices in Using the DataServiceContext Object ........................................................................... 60 Handling Relational Cloud Data Storage Tables ........................................................................................... 60 Summary .................................................................................................................................................... 65 ■ Chaper 3: Working with Cloud Queue and Blob Storage .................................................. 67 Azure Queue ............................................................................................................................................... 67 Azure Blob Storage ..................................................................................................................................... 69 Creating a Cloud Queue .............................................................................................................................. 70 Add a Worker Role in the Cloud Service Solution .................................................................................... 70 Create a Queue Storage Container and Create a Named Queue from the Start Handler of the Worker Role .............................................................................................. 71 Create the Queue Using Account Information from the Configuration File .......................................... 72 Create the Queue Programatically ..................................................................................................... 74 vi ■ CONTENTS Put a Message into the Queue ............................................................................................................... 74 Poll and Delete a Message from the Queue ............................................................................................ 76 Delete a Message from the Queue ......................................................................................................... 78 Parse a Message Received from the Queue ........................................................................................... 78 Query a Queue Using HTTP REST ........................................................................................................... 80 Creating Cloud Blob Storage ....................................................................................................................... 80 Creating a Loosely Coupled Event-Driven System ....................................................................................... 89 Implementing a Client Application to Access Cloud Blob Storage ................................................................. 96 Summary .................................................................................................................................................. 111 ■ Chapter 4: Windows Azure Application Integration Using WCF ..................................... 113 Using WCF ................................................................................................................................................ 114 Host WCF Service from Azure ................................................................................................................... 114 Verify HostWCFService from the Local Development Environment ............................................................. 127 Summary .................................................................................................................................................. 128 ■ Chapter 5: Azure .NET Services—Access Control ......................................................... 129 Working with the .NET Access Control Service .......................................................................................... 129 Build Your First Cloud Application Using the .NET Access Control Service .................................................. 131 CardSpace .Net Access Control Services ................................................................................................... 142 AzureForDotNetDeveloperWCFserviceLibrary ....................................................................................... 142 Service Implementations and Configurations ........................................................................................ 144 Client Implementations and Configurations .......................................................................................... 146 Test Results for What We Have Built .................................................................................................... 148 Authentication Using X.509 Certification or CardSpace in .NET Access Control Service ......................... 149 Installing the X.509 Certificate ........................................................................................................ 149 Associating the Certificate to the Azure Application URL .................................................................. 153 Using CardSpace in the .NET Access Control Service ...................................................................... 155 Summary .................................................................................................................................................. 171 ■ Chaprter 6: Azure .NET Services— Service Bus ............................................................ 171 Connecting to Remote Applications with the Service Bus .......................................................................... 171 Service Name Hierarchy System .......................................................................................................... 173 Service Registry and Publishing ........................................................................................................... 173 Endpoint Relay Connectivity ................................................................................................................. 173 Using WCF with the Service Bus .......................................................................................................... 173 Post a Net Event Using Relay Connection .................................................................................................. 175 Simple Direct Connected System Using Hybrid Relay Connection Mode .................................................... 184 vii ■ CONTENTS Using .NET Service Bus to Build a Distributed Connected Windows Application ......................................... 191 SoftnetSolutions.IShape ....................................................................................................................... 192 SoftnetSolutions.Shape ........................................................................................................................ 192 SoftnetSolutions.RelayService.ServiceContract..................................................................................... 195 SoftnetSolutions.Shape.Draw ............................................................................................................... 196 SoftnetSolutions.RelayService.ShapeController .................................................................................... 198 Port Forwarding ................................................................................................................................... 200 Change Credential Type ....................................................................................................................... 202 .NET Service Bus Queue Client Facade...................................................................................................... 204 Summary .................................................................................................................................................. 209 ■ Chapter 7: Azure .NET Services—Workflows ................................................................ 211 Hosting a Workflow Service in an Azure Cloud Environment ...................................................................... 212 Coordinating WF Services Using HttpWebRequest ..................................................................................... 221 Summary .................................................................................................................................................. 242 ■ Chapter 8: SQL Azure .................................................................................................... 243 Create a Virtual Server for SQL Azure ........................................................................................................ 244 Connect to a SQL Azure Database Using SQL Server Management Studio ................................................. 245 Create a Data Table Using SQL Server Management Studio ...................................................................... 248 Simple Benchmark Testing Results ........................................................................................................... 249 Verifying That SQL Azure Supports Relational Data Tables ........................................................................ 251 Connect to a SQL Azure Database Using ADO.NET .................................................................................... 255 Migrate Existing Databases from an On-Premises System to SQL Azure .................................................... 256 SQL Azure Application Developing Tool: SQLAzureConnect........................................................................ 260 Functions of SQLAzureConnect ............................................................................................................ 261 Using XML Data to Define UI Components Dynamically ........................................................................ 263 SQLDataAccessComponent Class ......................................................................................................... 266 SQLDataAccessHelper Class ................................................................................................................ 271 Component Design and Implementation .................................................................................................... 282 ParameterControl ................................................................................................................................. 283 SQLDataServiceControl ........................................................................................................................ 286 FormSQLAzureConnect ........................................................................................................................ 294 Summary .................................................................................................................................................. 296 ■ Chapter 9: Deploy Applications and Production Maintenance ...................................... 297 Preparing the Application Package and Configuration Package for Deployment ......................................... 297 Deploying Table Storage ........................................................................................................................... 299 viii

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.