Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Daniel Wang Senior Software Developer Microsoft Corporation  Stefan Schackow Senior Program Manager Microsoft Corporation ES17.

Similar presentations


Presentation on theme: " Daniel Wang Senior Software Developer Microsoft Corporation  Stefan Schackow Senior Program Manager Microsoft Corporation ES17."— Presentation transcript:

1  Daniel Wang Senior Software Developer Microsoft Corporation  Stefan Schackow Senior Program Manager Microsoft Corporation ES17

2

3

4

5

6

7

8 Storage Services Public Internet Web Role Load Balancer

9 Storage Service Public Internet Worker Role

10

11 namespace Microsoft.ServiceHosting.ServiceRuntime { public class RoleManager { //Properties public static Boolean IsRoleManagerRunning { get; } //Methods public static String GetConfigurationSetting(String roleSettingName); public static ILocalResource GetLocalResource(String localResourceName); public static void WriteToLog(String eventLogName, String message); } public interface ILocalResource { //Properties Int32 MaximumSizeInMegaBytes { get; } String Name { get; } String RootPath { get; } } …

12 public abstract class RoleEntryPoint { //Constructors protected RoleEntryPoint(); //Methods … public abstract RoleStatus GetHealthStatus(); public abstract void Start(); … } public enum RoleStatus { Healthy …, Unhealthy, … }

13

14 BlockBlobContainerAccount Pictures IMG001.JPG IMG002.JPG MoviesMOV1.AVI Block AAAA Block AAAB Block AAAC

15 MessageQueueAccount Thumbnail Jobs 128x128, http://… 256x256, http://… Indexing Jobs http://…

16 EntityTableAccount Users Name=…hash=… PhotoIndex Tag=…id=… Tag=…,id=…

17

18  Daniel Wang Senior SDE Windows Azure

19

20 Public Internet Web Role Storage Service Worker Role Load Balancer

21 Public Internet Web Role Storage Service Worker Role Load Balancer

22 C:\powershell.exe … PS C:\> c:\sdksamples\CloudDrive\scripts\MountDrive.ps1 Name Provider Root ---- -------- ---- Blob BlobDrive http://127.0.0.1:10000 PS C:\> dir blob: PS C:\> mkdir blob:/photos PS C:\> copy-cd c:\localphotos\*.JPG blob:\photos\ PS C:\> (get-item blob:\photos).SetPublic() PS C:\> cd blob:photos PS blob:\photos> dir PS blob:\photos> $url = (get-item IMG_206.JPG).FullName PS blob:\photos> explorer $url

23 GET http://.../photos?comp=list&maxresult=1 1 IMG_0155.JPG http://…/photos/IMG_0155.JPG Sat, 11 Oct 2008 21:37:05 GMT 0x8CAFA00A39C6742 1901534 image/jpeg IMG_0156.JPG

24 PS C:\> $photos = get-item blob:\photos PS C:\> $request = $photos.FullName + "?comp=list“ PS C:\> $wc = new-object net.webclient PS C:\> $reply = $wc.DownloadString($request) # Substring(3) needed to strip off BOM which confuses # powershell PS C:\> [xml]$reply.Substring(3) | format-custom

25 Public Internet Web Role Storage Service Worker Role Load Balancer

26 … <asp:BoundField HeaderText="Last Modified" DataField="LastModified" /> <asp:BoundField HeaderText="Size" DataField="Size" /> <asp:HyperLinkField HeaderText="Name" DataTextField="Name" DataNavigateUrlFields="Url" /> <asp:ImageField HeaderText="Thumbnail" DataImageUrlField="Thumbnail" />

27 using System; using Microsoft.Samples.ServiceHosting.SharePhotos; namespace SharePhotos_WebRole { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { GridView1.DataSource = PhotoStore.Default.GetPhotos(); GridView1.DataBind(); }

28 public class PhotoInfo { PhotoStore ps; Uri thumbnail; public long Size { get; private set; } public DateTime LastModified { get; private set; } public string Name { get; private set; } public Uri Url { get; private set; } public Uri Thumbnail { get { if (thumbnail == null) { thumbnail = ps.GetThumbnail(Url); } return thumbnail; }

29 public IEnumerable GetPhotos() { string nextMarker = null; do { var request = StorageClient.ContainerListBlobs(Container,"", "/", nextMarker, 5); var xdoc = request.GetResponseWithRetry().GetResponseXDocument(); var enumResults = xdoc.Element("EnumerationResults"); var blobs = enumResults.Element("Blobs").Elements("Blob"); foreach (var blob in blobs) { string name = (string)blob.Element("Name"); if (name.EndsWith("JPG")) { yield return new PhotoInfo(this, blob); } nextMarker = (string)enumResults.Element("NextMarker"); } while (!string.IsNullOrEmpty(nextMarker)); yield break; } Retry on transient failures Marker acts as iteration index into collection

30 Public Internet Web Role Storage Service Worker Role Load Balancer

31 public class WorkerRole : RoleEntryPoint { … public override void Start() { Thread background = new Thread(RefreshAll); background.Start(); RefreshUpdated(); } public void RefreshAll() { … } public void RefreshUpdated() { … } }

32

33 Provider based features Traditional file I/O Linq Application Database Blob storage Astoria Table storage Business/data layer abstractions insulate applications from underlying storage

34  Stefan Schackow Senior Program Manager ASP.NET

35

36

37 Public Internet Public Internet Storage Service LAMP

38 PHP Core Engine WA Class Gallery WA Mods Blob REST API wrapped into PHP Objects WS subclass inherited from Windows NT Platform class

39 Add DotNetOpenId.dll to /bin () (http://code.google.com/p/dotnetopenid/) Modify login.aspx Add the ASP.NET OpenID Login control

40 Add to login.aspx.cs protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e) { HttpCookie cookie = new HttpCookie("comment"); cookie.Expires = DateTime.Now.AddMonths(24); cookie.Values.Add("name", e.Response.FriendlyIdentifierForDisplay); cookie.Values.Add("email",e.Response.GetExtension ().Email); cookie.Values.Add("url", e.Response.ClaimedIdentifier); cookie.Values.Add("country",e.Response.GetExtension ().Country); Response.Cookies.Add(cookie); }

41

42

43 Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com

44

45 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

46


Download ppt " Daniel Wang Senior Software Developer Microsoft Corporation  Stefan Schackow Senior Program Manager Microsoft Corporation ES17."

Similar presentations


Ads by Google