<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Technical Notes</title><link>http://blogs.msdn.com/b/morebits/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Building Windows Azure Service Part7: Service Testing</title><link>http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx</link><pubDate>Wed, 05 Jan 2011 01:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10111786</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10111786</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx#comments</comments><description>&lt;p&gt;In this post, you will test the GuestBook application in the &lt;b&gt;Development Fabric&lt;/b&gt; (aka, &lt;b&gt;devfabric&lt;/b&gt;). The devfabric is a simulated environment for developing and testing Windows Azure applications on your test machine. &lt;/p&gt;  &lt;p&gt;   &lt;table style="background-color: #c0c0c0; cellpading: 0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;&lt;em&gt;A Visual Studio project with source code is available at the end of this post to accompany the subject matter discussed.&lt;/em&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;In &lt;b&gt;Visual Studio&lt;/b&gt;, press &lt;b&gt;F5&lt;/b&gt; to execute the service. The service builds and then launches the local development fabric. To show the development fabric UI, right-click its icon located in the system tray and select &lt;b&gt;Show Development Fabric UI&lt;/b&gt;.       &lt;blockquote&gt;       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2350.image_5F00_73E54C76.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5481.image_5F00_thumb_5F00_715C1AB8.png" width="240" height="118" /&gt;&lt;/a&gt; &lt;/p&gt;     &lt;/blockquote&gt;      &lt;blockquote&gt;       &lt;p&gt;&lt;b&gt;Figure 9 Development Fabric UI&lt;/b&gt;&lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;Switch to &lt;strong&gt;Internet Explorer&lt;/strong&gt; to view the GuestBook application. &lt;/li&gt;    &lt;li&gt;Add a new entry to the guest book as described in the next steps. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Type&lt;/strong&gt; your name and a message. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Choose&lt;/strong&gt; an image to upload. It is a good idea to choose a large high resolution image because the guestbook service will resize it. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Click&lt;/strong&gt; the pencil icon to submit the entry. &lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5305.image_5F00_7736BE51.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/1106.image_5F00_thumb_5F00_369471E2.png" width="312" height="125" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;b&gt;Figure 10 GuestBook Home Page&lt;/b&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Once you submit an entry, the web role creates a new entry in the guest book table and uploads the photo to the &lt;strong&gt;Blob Storage&lt;/strong&gt;. The page contains a timer that triggers a page refresh every 5 seconds, so the new entry should appear on the page after a brief interval.&lt;/p&gt;  &lt;p&gt;Initially, the new entry contains a link to the blob that contains the uploaded image so it will appear with the same size as the original image. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0513.image_5F00_2F090275.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5315.image_5F00_thumb_5F00_7D4DE51F.png" width="499" height="254" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 11 GuestBook Image Original Size&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;After a few seconds, the page refreshes and displays the thumbnail that the worker role generated. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/7853.image_5F00_3FFD0A8B.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2350.image_5F00_thumb_5F00_783B81A3.png" width="335" height="154" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 12 GuestBook Generated Thumbnail&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;For related topics, see the following posts.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6: Service Configuration&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;/p&gt;  &lt;ol&gt;&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10111786" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-11-17-86/GuestBook.zip" length="3924879" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Building Windows Azure Service Part6: Service Configuration</title><link>http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx</link><pubDate>Wed, 05 Jan 2011 00:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10111772</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10111772</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx#comments</comments><description>&lt;p&gt;You can update your service's configuration while the service is running without taking the service offline. The service configuration (.cscfg) file contains the service's configuration.&lt;/p&gt;  &lt;p&gt;To change configuration information, you can either upload a new configuration file, or edit the configuration file in place and apply it to your running service. This does not apply to certificate changes that are always done off-line.&lt;/p&gt;  &lt;p&gt;For more information about the service configuration files, see &lt;a href="http://msdn.microsoft.com/en-us/library/ee758710.aspx"&gt;Service Configuration Schema&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;For practical information on service configuration, see also &lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/01/using-windows-azure-development-environment-essentials.aspx"&gt;Using Windows Azure Development Environment Essentials&lt;/a&gt;.&lt;/p&gt;  &lt;h5&gt;Handling Configuration Changes with Service Runtime Events&lt;/h5&gt;  &lt;p&gt;The Windows Azure Managed Library includes the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.aspx"&gt;Microsoft.WindowsAzure.ServiceRuntime&lt;/a&gt; namespace, which provides classes for interacting with the Windows Azure environment from code running in a role instance. The &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.aspx"&gt;RoleEnvironment&lt;/a&gt; class defines events raised before and after a configuration change:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.changing.aspx"&gt;RoleEnvironment.Changing&lt;/a&gt; event occurs before the configuration change is applied to a given instance of a role. This event may be cancelled, in which case Windows Azure recycles the role. When the role is recycled, the configuration change is applied before the role is brought back online again. &lt;/li&gt;    &lt;li&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.changed.aspx"&gt;RoleEnvironment.Changed&lt;/a&gt; event occurs after the configuration change has been applied to a given instance of a role. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;   &lt;table style="background-color: #c0c0c0; cellpading: 0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;&lt;em&gt;The &lt;strong&gt;Changing&lt;/strong&gt; and &lt;strong&gt;Changed&lt;/strong&gt; events are raised regardless of the health of any particular role instance. The Windows Azure Managed Library does not provide a means of determining the health of other role instances, but you can implement such health assessments yourself if your service needs this functionality.&lt;/em&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;h5&gt;Changing Event&lt;/h5&gt;  &lt;p&gt;The &lt;strong&gt;Changing&lt;/strong&gt; event allows you to manage how a role instance responds to a configuration change. Via the &lt;strong&gt;Changing&lt;/strong&gt; event, an instance can respond to a configuration change in one of two ways:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The instance can accept the configuration change on the fly, without going offline. &lt;/li&gt;    &lt;li&gt;The instance can cancel the &lt;strong&gt;Changing&lt;/strong&gt; event, in which case Windows Azure takes the instance offline, applies the configuration change, and then brings the instance back online. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;By cancelling the &lt;strong&gt;Changing&lt;/strong&gt; event, you can ensure that the instance proceeds through an orderly shutdown sequence and is taken offline before the configuration change is applied. During the shutdown process, Windows Azure raises the &lt;strong&gt;Stopping&lt;/strong&gt; event, then runs any code in the &lt;strong&gt;OnStop&lt;/strong&gt; method.&lt;/p&gt;  &lt;p&gt;The total interval allowed for an instance's shutdown sequence is 30 seconds; if your code has not finished running within this interval, the process will automatically be terminated.&lt;/p&gt;  &lt;p&gt;You may wish to cancel the &lt;strong&gt;Changing&lt;/strong&gt; event if:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Your role does not support on-the-fly configuration changes, and requires recycling in order to apply the change. &lt;/li&gt;    &lt;li&gt;Your role is in the midst of performing work that should not be disrupted by a configuration change, and needs to proceed through the shutdown sequence before applying the change. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Configuration Related Exception&lt;/h5&gt;  &lt;p&gt;When running the application, the system can raise the following exception:&lt;/p&gt;  &lt;p&gt;SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used&lt;/p&gt;  &lt;p&gt;Usually this happens when a web role is migrated from an older Windows Azure SDK version and is caused by changes associated with the full IIS model introduced in newer SDK versions. In the newer version the &lt;i&gt;SetConfigurationSettingPublisher&lt;/i&gt; and &lt;i&gt;FromConfigurationSetting&lt;/i&gt; belong to different “app domains”. For more information, see &lt;a href="http://blog.smarx.com/posts/how-to-resolve-setconfigurationsettingpublisher-needs-to-be-called-before-fromconfigurationsetting-can-be-used-after-moving-to-windows-azure-sdk-1-3"&gt;How to Resolve…&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;To avoid the exception you must assure that the following code is executed in the &lt;i&gt;OnStart&lt;/i&gt; method of the web and worker roles before calling &lt;i&gt;FromConfigurationSetting&lt;/i&gt; . In the case of the web role you can execute the code in the &lt;i&gt;Application_Start&lt;/i&gt; method in the &lt;i&gt;Global.ascx.cs&lt;/i&gt; file.&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;CloudStorageAccount&lt;/span&gt;.SetConfigurationSettingPublisher((configName, configSetter) =&amp;gt;
    {
        &lt;span style="color: blue"&gt;try
        &lt;/span&gt;{   &lt;span style="color: green"&gt;// Retrieves the value of a setting in the service configuration file. 
            &lt;/span&gt;configSetter(&lt;span style="color: #2b91af"&gt;RoleEnvironment&lt;/span&gt;.GetConfigurationSettingValue(configName));
        }
        &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;RoleEnvironmentException &lt;/span&gt;e)
        {

            System.Diagnostics.&lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceError(e.Message);
            System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(5000);
        }
    });&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;For related topics, see the following posts.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10111772" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Building Windows Azure Service Part5: Worker Role Background Tasks Handler</title><link>http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx</link><pubDate>Sat, 01 Jan 2011 23:33:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10110839</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10110839</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx#comments</comments><description>&lt;p&gt;In this post you will create a worker role to read work items posted to a queue by the web role front-end. The worker role performs these tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Extract the information about the guest book entry from the message queued by the web role in the Queue Storage. &lt;/li&gt;    &lt;li&gt;Retrieve the user entry from the Table Storage. &lt;/li&gt;    &lt;li&gt;Fetch the associated image from the Blob Storage and create a thumbnail and store it is as a blob. &lt;/li&gt;    &lt;li&gt;Finally, update the entry to include the URL of the generated thumbnail. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;To create the worker role&lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, right click the &lt;b&gt;Roles&lt;/b&gt; node in the &lt;strong&gt;GuestBook&lt;/strong&gt; project. &lt;/li&gt;    &lt;li&gt;Select &lt;b&gt;Add&lt;/b&gt; and click &lt;b&gt;New Worker Role Project&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Add New Role Project&lt;/b&gt; dialog window, select the &lt;b&gt;Worker Role&lt;/b&gt; category and choose the Worker Role template for the language of your choice. &lt;/li&gt;    &lt;li&gt;In the name box, enter &lt;b&gt;GuestBook_WorkerRole&lt;/b&gt; and click &lt;b&gt;Add&lt;/b&gt;.       &lt;blockquote&gt;       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/3755.image_5F00_587C640B.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/3175.image_5F00_thumb_5F00_22B6F8E4.png" width="451" height="288" /&gt;&lt;/a&gt; &lt;/p&gt;     &lt;/blockquote&gt;      &lt;blockquote&gt;       &lt;p&gt;&lt;b&gt;Figure 7 Creating Worker Role Project&lt;/b&gt;&lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;b&gt;GuestBook_WorkerRole&lt;/b&gt; project and select &lt;b&gt;Add Reference&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Switch to the &lt;b&gt;Projects&lt;/b&gt; tab, select the &lt;b&gt;GuestBookData&lt;/b&gt; project and click &lt;b&gt;OK&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;b&gt;GuestBook_WorkerRole&lt;/b&gt; project, select &lt;b&gt;Add Reference&lt;/b&gt;, &lt;/li&gt;    &lt;li&gt;Switch to the &lt;b&gt;.Net&lt;/b&gt; tab, select the &lt;b&gt;System.Drawing&lt;/b&gt; component and click &lt;b&gt;OK&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Repeat the procedure in the previous steps to add a reference to the storage client API assembly, this time choosing the &lt;b&gt;Microsoft.WindowsAzure.StorageClient&lt;/b&gt; component instead. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;GuestBook_WorkerRole&lt;/b&gt; project, open the &lt;b&gt;WorkerRole.cs&lt;/b&gt; file. Replace its content with the following code.       &lt;blockquote&gt;       &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Diagnostics;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Threading;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.Diagnostics;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.ServiceRuntime;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Drawing;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.IO;
&lt;span style="color: blue"&gt;using &lt;/span&gt;GuestBook_Data;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.StorageClient;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;GuestBook_WorkerRole
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WorkerRole &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;RoleEntryPoint
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudQueue &lt;/span&gt;queue;
        &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudBlobContainer &lt;/span&gt;container;

        &lt;span style="color: blue"&gt;public override void &lt;/span&gt;Run()
        {
            &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(&lt;span style="color: #a31515"&gt;&amp;quot;Listening for queue messages...&amp;quot;&lt;/span&gt;);

            &lt;span style="color: blue"&gt;while &lt;/span&gt;(&lt;span style="color: blue"&gt;true&lt;/span&gt;)
            {
                &lt;span style="color: blue"&gt;try
                &lt;/span&gt;{
                    &lt;span style="color: green"&gt;// retrieve a new message from the queue
                    &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudQueueMessage &lt;/span&gt;msg = queue.GetMessage();
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(msg != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                    {
                        &lt;span style="color: green"&gt;// parse message retrieved from queue
                        &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;messageParts = msg.AsString.Split(&lt;span style="color: blue"&gt;new char&lt;/span&gt;[] { &lt;span style="color: #a31515"&gt;',' &lt;/span&gt;});
                        &lt;span style="color: blue"&gt;var &lt;/span&gt;uri = messageParts[0];
                        &lt;span style="color: blue"&gt;var &lt;/span&gt;partitionKey = messageParts[1];
                        &lt;span style="color: blue"&gt;var &lt;/span&gt;rowkey = messageParts[2];
                        &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(&lt;span style="color: #a31515"&gt;&amp;quot;Processing image in blob '{0}'.&amp;quot;&lt;/span&gt;, uri);

                        &lt;span style="color: green"&gt;// download original image from blob storage
                        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudBlockBlob &lt;/span&gt;imageBlob = container.GetBlockBlobReference(uri);
                        &lt;span style="color: #2b91af"&gt;MemoryStream &lt;/span&gt;image = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;();
                        imageBlob.DownloadToStream(image);
                        image.Seek(0, &lt;span style="color: #2b91af"&gt;SeekOrigin&lt;/span&gt;.Begin);

                        &lt;span style="color: green"&gt;// create a thumbnail image and upload into a blob
                        &lt;/span&gt;&lt;span style="color: blue"&gt;string &lt;/span&gt;thumbnailUri = &lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Concat(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.GetFileNameWithoutExtension(uri), &lt;span style="color: #a31515"&gt;&amp;quot;_thumb.jpg&amp;quot;&lt;/span&gt;);
                        &lt;span style="color: #2b91af"&gt;CloudBlockBlob &lt;/span&gt;thumbnailBlob = container.GetBlockBlobReference(thumbnailUri);
                        thumbnailBlob.UploadFromStream(CreateThumbnail(image));

                        &lt;span style="color: green"&gt;// update the entry in table storage to point to the thumbnail
                        &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;ds = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntryDataSource&lt;/span&gt;();
                        ds.UpdateImageThumbnail(partitionKey, rowkey, thumbnailBlob.Uri.AbsoluteUri);

                        &lt;span style="color: green"&gt;// remove message from queue
                        &lt;/span&gt;queue.DeleteMessage(msg);

                        &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(&lt;span style="color: #a31515"&gt;&amp;quot;Generated thumbnail in blob '{0}'.&amp;quot;&lt;/span&gt;, thumbnailBlob.Uri);
                    }
                    &lt;span style="color: blue"&gt;else
                    &lt;/span&gt;{
                        System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(1000);
                    }
                }
                &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StorageClientException &lt;/span&gt;e)
                {
                    &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceError(&lt;span style="color: #a31515"&gt;&amp;quot;Exception when processing queue item. Message: '{0}'&amp;quot;&lt;/span&gt;, e.Message);
                    System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(5000);
                }
            }
        }

        &lt;span style="color: blue"&gt;public override bool &lt;/span&gt;OnStart()
        {
            &lt;span style="color: #2b91af"&gt;DiagnosticMonitor&lt;/span&gt;.Start(&lt;span style="color: #a31515"&gt;&amp;quot;DiagnosticsConnectionString&amp;quot;&lt;/span&gt;);

            &lt;span style="color: green"&gt;// Restart the role upon all configuration changes
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RoleEnvironment&lt;/span&gt;.Changing += RoleEnvironmentChanging;


            &lt;span style="color: green"&gt;// Set the global configuration setting publisher for the storage account, which 
            // will be called when the account access keys are updated in the service configuration file.
            // Calling SetConfigurationSettingPublisher in OnStart method is important otherwise the
            // system raises an exception when FromConfigurationSetting is called.
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudStorageAccount&lt;/span&gt;.SetConfigurationSettingPublisher((configName, configSetter) =&amp;gt;
            {
                &lt;span style="color: blue"&gt;try
                &lt;/span&gt;{
                    configSetter(&lt;span style="color: #2b91af"&gt;RoleEnvironment&lt;/span&gt;.GetConfigurationSettingValue(configName));
                }
                &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;RoleEnvironmentException &lt;/span&gt;e)
                {

                    &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceError(e.Message);
                    System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(5000);
                }
            });

            &lt;span style="color: green"&gt;// Create a new instance of a CloudStorageAccount object from a specified configuration setting. 
            // This method may be called only after the SetConfigurationSettingPublisher 
            // method has been called to configure the global configuration setting publisher.
            // You can call the SetConfigurationSettingPublisher method in the OnStart method
            // of the worker role before calling FromConfigurationSetting.
            // If you do not do this, the system raises an exception. 
            &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;storageAccount = 
                &lt;span style="color: #2b91af"&gt;CloudStorageAccount&lt;/span&gt;.FromConfigurationSetting(&lt;span style="color: #a31515"&gt;&amp;quot;DataConnectionString&amp;quot;&lt;/span&gt;);

            &lt;span style="color: green"&gt;// initialize blob storage
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudBlobClient &lt;/span&gt;blobStorage = storageAccount.CreateCloudBlobClient();
            container = blobStorage.GetContainerReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestbookpics&amp;quot;&lt;/span&gt;);

            &lt;span style="color: green"&gt;// initialize queue storage 
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudQueueClient &lt;/span&gt;queueStorage = storageAccount.CreateCloudQueueClient();
            queue = queueStorage.GetQueueReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestthumbs&amp;quot;&lt;/span&gt;);

            &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(&lt;span style="color: #a31515"&gt;&amp;quot;Creating container and queue...&amp;quot;&lt;/span&gt;);

            &lt;span style="color: blue"&gt;bool &lt;/span&gt;storageInitialized = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
            &lt;span style="color: blue"&gt;while &lt;/span&gt;(!storageInitialized)
            {
                &lt;span style="color: blue"&gt;try
                &lt;/span&gt;{
                    &lt;span style="color: green"&gt;// create the blob container and allow public access
                    &lt;/span&gt;container.CreateIfNotExist();
                    &lt;span style="color: green"&gt;// container.CreateIfNotExist();
                    &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;permissions = container.GetPermissions();
                    permissions.PublicAccess = &lt;span style="color: #2b91af"&gt;BlobContainerPublicAccessType&lt;/span&gt;.Container;
                    container.SetPermissions(permissions);

                    &lt;span style="color: green"&gt;// create the message queue
                    &lt;/span&gt;queue.CreateIfNotExist();
                    storageInitialized = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
                }
                &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StorageClientException &lt;/span&gt;e)
                {
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.ErrorCode == &lt;span style="color: #2b91af"&gt;StorageErrorCode&lt;/span&gt;.TransportError)
                    {
                        &lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceError(&lt;span style="color: #a31515"&gt;&amp;quot;Storage services initialization failure. &amp;quot;
                          &lt;/span&gt;+ &lt;span style="color: #a31515"&gt;&amp;quot;Check your storage account configuration settings. If running locally, &amp;quot;
                          &lt;/span&gt;+ &lt;span style="color: #a31515"&gt;&amp;quot;ensure that the Development Storage service is running. Message: '{0}'&amp;quot;&lt;/span&gt;, e.Message);
                        System.Threading.&lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(5000);
                    }
                    &lt;span style="color: blue"&gt;else
                    &lt;/span&gt;{
                        &lt;span style="color: blue"&gt;throw&lt;/span&gt;;
                    }
                }
            }

            &lt;span style="color: blue"&gt;return base&lt;/span&gt;.OnStart();
        }

        &lt;span style="color: blue"&gt;private void &lt;/span&gt;RoleEnvironmentChanging(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoleEnvironmentChangingEventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.Changes.Any(change =&amp;gt; change &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RoleEnvironmentConfigurationSettingChange&lt;/span&gt;))
                e.Cancel = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        }

        &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Stream &lt;/span&gt;CreateThumbnail(&lt;span style="color: #2b91af"&gt;Stream &lt;/span&gt;input)
        {
            &lt;span style="color: blue"&gt;var &lt;/span&gt;orig = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Bitmap&lt;/span&gt;(input);
            &lt;span style="color: blue"&gt;int &lt;/span&gt;width;
            &lt;span style="color: blue"&gt;int &lt;/span&gt;height;

            &lt;span style="color: blue"&gt;if &lt;/span&gt;(orig.Width &amp;gt; orig.Height)
            {
                width = 128;
                height = 128 * orig.Height / orig.Width;
            }
            &lt;span style="color: blue"&gt;else
            &lt;/span&gt;{
                height = 128;
                width = 128 * orig.Width / orig.Height;
            }

            &lt;span style="color: blue"&gt;var &lt;/span&gt;thumb = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Bitmap&lt;/span&gt;(width, height);

            &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Graphics &lt;/span&gt;graphic = &lt;span style="color: #2b91af"&gt;Graphics&lt;/span&gt;.FromImage(thumb))
            {
                graphic.InterpolationMode = System.Drawing.Drawing2D.&lt;span style="color: #2b91af"&gt;InterpolationMode&lt;/span&gt;.HighQualityBicubic;
                graphic.SmoothingMode = System.Drawing.Drawing2D.&lt;span style="color: #2b91af"&gt;SmoothingMode&lt;/span&gt;.AntiAlias;
                graphic.PixelOffsetMode = System.Drawing.Drawing2D.&lt;span style="color: #2b91af"&gt;PixelOffsetMode&lt;/span&gt;.HighQuality;
                graphic.DrawImage(orig, 0, 0, width, height);
                &lt;span style="color: blue"&gt;var &lt;/span&gt;ms = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;();
                thumb.Save(ms, System.Drawing.Imaging.&lt;span style="color: #2b91af"&gt;ImageFormat&lt;/span&gt;.Jpeg);
                ms.Seek(0, &lt;span style="color: #2b91af"&gt;SeekOrigin&lt;/span&gt;.Begin);
                &lt;span style="color: blue"&gt;return &lt;/span&gt;ms;
            }
        }
    }
}&lt;/pre&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;

  &lt;li&gt;Save and close the &lt;b&gt;WorkerRole.cs&lt;/b&gt; file. 

    &lt;h5&gt;To configure the storage account used for worker role&lt;/h5&gt;

    &lt;p&gt;In order for the worker role to use Windows Azure storage services, you must provide account settings as described next.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, expand the Role node in the &lt;b&gt;GuestBook&lt;/b&gt; project. &lt;/li&gt;

  &lt;li&gt;Double click &lt;b&gt;GuestBook_WokerRole&lt;/b&gt; to open the properties for this role and select &lt;b&gt;Settings&lt;/b&gt; tab. &lt;/li&gt;

  &lt;li&gt;Click &lt;b&gt;Add Settings&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Name&lt;/b&gt; column, enter &lt;i&gt;DataConnectionString&lt;/i&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Type&lt;/b&gt; column, from the drop-down list, select &lt;i&gt;ConnectionString&lt;/i&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Value&lt;/b&gt; column, from the drop-down list, select &lt;i&gt;Use development storage&lt;/i&gt;. 

    &lt;blockquote&gt;
      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/1524.image_5F00_40B506D8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2133.image_5F00_thumb_5F00_430E88D6.png" width="413" height="219" /&gt;&lt;/a&gt; &lt;/p&gt;
    &lt;/blockquote&gt;

    &lt;blockquote&gt;
      &lt;p&gt;&lt;b&gt;Figure 8 Configuring Storage Account For Worker Role&lt;/b&gt;&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;C&lt;/b&gt;lick &lt;b&gt;OK&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;Press &lt;b&gt;Ctrl+S &lt;/b&gt;to save your changes. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For related topics, see the following posts.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6:&amp;#160; Service Configuration&lt;/a&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx"&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10110839" width="1" height="1"&gt;</description></item><item><title>Building Windows Azure Service Part4: Web Role UI Handler</title><link>http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx</link><pubDate>Thu, 30 Dec 2010 22:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10110449</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10110449</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx#comments</comments><description>&lt;p&gt;In this post, you will create the UI that enables the user to perform read, write operations on the &lt;strong&gt;GuestBookEntry&lt;/strong&gt; table. You will update the web role project generated when you created the Windows Azure service. Specifically, you will perform the following tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Add a page to the project that contains the UI to display the guest &lt;strong&gt;GuestBookEntry&lt;/strong&gt; table. &lt;/li&gt;    &lt;li&gt;Create the code that enables the user to store guest information in &lt;strong&gt;Table Storage&lt;/strong&gt; and images in &lt;strong&gt;Blob Storage&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Finally, configure the storage account used by the web role. &lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ff0000" size="4" face="Blackadder ITC"&gt;&lt;strong&gt;Happy Holidays&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000" size="4" face="Blackadder ITC"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/1643.ChristmasTree_5F00_0269A345.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ChristmasTree" border="0" alt="ChristmasTree" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5543.ChristmasTree_5F00_thumb_5F00_2D61914A.png" width="103" height="95" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h5&gt;To render the guest book&lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;In &lt;strong&gt;Solution Explorer&lt;/strong&gt; right-click the &lt;b&gt;GuestBook_WebRole&lt;/b&gt; project, select &lt;b&gt;Add Reference&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Add a reference to the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.aspx"&gt;Microsoft.WindowsAzure.StorageClient&lt;/a&gt;&lt;b&gt;&lt;/b&gt; assembly. &lt;/li&gt;    &lt;li&gt;Add a reference to the &lt;b&gt;GuestBookData&lt;/b&gt; project. &lt;/li&gt;    &lt;li&gt;Open the default.aspx file. &lt;/li&gt;    &lt;li&gt;Replace the file content with the following markup. &lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;pre class="code"&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: maroon"&gt;Page &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Default.aspx.cs&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GuestBook_WebRole._Default&amp;quot; &lt;/span&gt;&lt;span style="background: yellow"&gt;%&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: maroon"&gt;DOCTYPE &lt;/span&gt;&lt;span style="color: red"&gt;html PUBLIC &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;html &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;head &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Head1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;Windows Azure Guestbook&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;link &lt;/span&gt;&lt;span style="color: red"&gt;href&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;main.css&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;rel&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;stylesheet&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text/css&amp;quot; /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;head&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;form &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ScriptManager &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ScriptManager1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;general&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;title&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;h1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &lt;/span&gt;Windows Azure GuestBook
            &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;h1&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;inputSection&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;label &lt;/span&gt;&lt;span style="color: red"&gt;for&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NameLabel&amp;quot;&amp;gt;&lt;/span&gt;Name:&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TextBox 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NameTextBox&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;CssClass&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;field&amp;quot;/&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RequiredFieldValidator 
                      &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NameRequiredValidator&amp;quot; 
                      &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                      &lt;/span&gt;&lt;span style="color: red"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NameTextBox&amp;quot;
                      &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;label &lt;/span&gt;&lt;span style="color: red"&gt;for&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MessageLabel&amp;quot;&amp;gt;&lt;/span&gt;Message:&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TextBox 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MessageTextBox&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;TextMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MultiLine&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;CssClass&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;field&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RequiredFieldValidator 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MessageRequiredValidator&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MessageTextBox&amp;quot;
                       &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;label &lt;/span&gt;&lt;span style="color: red"&gt;for&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FileUpload1&amp;quot;&amp;gt;&lt;/span&gt;Photo:&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dt&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;FileUpload 
                        &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FileUpload1&amp;quot; 
                        &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                        &lt;/span&gt;&lt;span style="color: red"&gt;size&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;16&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RequiredFieldValidator 
                        &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;PhotoRequiredValidator&amp;quot; 
                        &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                        &lt;/span&gt;&lt;span style="color: red"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FileUpload1&amp;quot;
                        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RegularExpressionValidator 
                        &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;PhotoRegularExpressionValidator&amp;quot;
                        &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;
                        &lt;/span&gt;&lt;span style="color: red"&gt;ControlToValidate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;FileUpload1&amp;quot; 
                        &lt;/span&gt;&lt;span style="color: red"&gt;ErrorMessage&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Only .jpg or .png files are allowed&amp;quot;
                        &lt;/span&gt;&lt;span style="color: red"&gt;ValidationExpression&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;([a-zA-Z\\].*(.jpg|.JPG|.png|.PNG)$)&amp;quot; /&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dd&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;dl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;inputSignSection&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SignButton&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;AlternateText&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Sign GuestBook&amp;quot;
                       &lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SignButton_Click&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ImageUrl&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;~/sign.png&amp;quot; 
                       &lt;/span&gt;&lt;span style="color: red"&gt;ImageAlign&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bottom&amp;quot;  /&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;UpdatePanel &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;UpdatePanel1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DataList 
                   &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DataList1&amp;quot; 
                   &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
                   &lt;/span&gt;&lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ObjectDataSource1&amp;quot;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signature&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureImage&amp;quot;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;a &lt;/span&gt;&lt;span style="color: red"&gt;href&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&amp;quot;PhotoUrl&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;target&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;_blank&amp;quot;&amp;gt;
                                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&amp;quot;ThumbnailUrl&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot; 
                                         &lt;/span&gt;&lt;span style="color: red"&gt;alt&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&amp;quot;GuestName&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot; /&amp;gt;
                                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;a&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureDescription&amp;quot;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureName&amp;quot;&amp;gt;
                                    &lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;GuestName&amp;quot;&lt;/span&gt;) &lt;span style="background: yellow"&gt;%&amp;gt;
&lt;/span&gt;                                &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureSays&amp;quot;&amp;gt;
                                    &lt;/span&gt;says
                                &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureDate&amp;quot;&amp;gt;
                                    &lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt;((&lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;)Eval(&lt;span style="color: #a31515"&gt;&amp;quot;Timestamp&amp;quot;&lt;/span&gt;)).ToShortDateString() &lt;span style="background: yellow"&gt;%&amp;gt;
&lt;/span&gt;                                &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;signatureMessage&amp;quot;&amp;gt;
                                    &lt;/span&gt;&amp;quot;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;Message&amp;quot;&lt;/span&gt;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&amp;quot;
                                &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DataList&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Timer 
                    &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Timer1&amp;quot; 
                    &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;
                    &lt;/span&gt;&lt;span style="color: red"&gt;Interval&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15000&amp;quot;
                    &lt;/span&gt;&lt;span style="color: red"&gt;OnTick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Timer1_Tick&amp;quot;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Timer&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ContentTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;UpdatePanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource 
           &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ObjectDataSource1&amp;quot;
           &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; 
           &lt;/span&gt;&lt;span style="color: red"&gt;DataObjectTypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GuestBook_Data.GuestBookEntry&amp;quot;
           &lt;/span&gt;&lt;span style="color: red"&gt;InsertMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AddGuestBookEntry&amp;quot;
           &lt;/span&gt;&lt;span style="color: red"&gt;SelectMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Select&amp;quot; 
           &lt;/span&gt;&lt;span style="color: red"&gt;TypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GuestBook_Data.GuestBookEntryDataSource&amp;quot;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;html&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;h5&gt;To store guest information in Table and Blob Storage&lt;/h5&gt;

&lt;p&gt;To allow the user to enter guest information and store the entry in &lt;strong&gt;Table Storage&lt;/strong&gt; and the related image in the &lt;strong&gt;Blob Storage&lt;/strong&gt;, you must execute the following steps.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In &lt;strong&gt;Solution Explorer&lt;/strong&gt; open the &lt;strong&gt;default.aspx.cs&lt;/strong&gt; file. &lt;/li&gt;

  &lt;li&gt;Replace the file content with the following code. &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI.WebControls;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Net;
&lt;span style="color: blue"&gt;using &lt;/span&gt;GuestBook_Data;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.ServiceRuntime;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.StorageClient;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;GuestBook_WebRole
{
    &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;_Default &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;Page
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;private static bool &lt;/span&gt;storageInitialized = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
        &lt;span style="color: blue"&gt;private static object &lt;/span&gt;gate = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Object&lt;/span&gt;();
        &lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudBlobClient &lt;/span&gt;blobStorage;
        &lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudQueueClient &lt;/span&gt;queueStorage;

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(!Page.IsPostBack)
            {
                Timer1.Enabled = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
            }
        }

     
        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;SignButton_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(FileUpload1.HasFile)
            {
                InitializeStorage();
                
                &lt;span style="color: green"&gt;// upload the image to blob storage
         &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudBlobContainer &lt;/span&gt;container = blobStorage.GetContainerReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestbookpics&amp;quot;&lt;/span&gt;);
                &lt;span style="color: blue"&gt;string &lt;/span&gt;uniqueBlobName = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;image_{0}.jpg&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid().ToString());
                &lt;span style="color: #2b91af"&gt;CloudBlockBlob &lt;/span&gt;blob = 
container.GetBlockBlobReference(uniqueBlobName);
                blob.Properties.ContentType = FileUpload1.PostedFile.ContentType;
                blob.UploadFromStream(FileUpload1.FileContent);
                System.Diagnostics.&lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(
&lt;span style="color: #a31515"&gt;&amp;quot;Uploaded image '{0}' to blob storage as '{1}'&amp;quot;&lt;/span&gt;, 
FileUpload1.FileName, uniqueBlobName);

                &lt;span style="color: green"&gt;// create a new entry in table storage
                &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntry &lt;/span&gt;entry = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntry&lt;/span&gt;() { GuestName = 
NameTextBox.Text, Message = MessageTextBox.Text, PhotoUrl = 
blob.Uri.ToString(), ThumbnailUrl = blob.Uri.ToString() };
                &lt;span style="color: #2b91af"&gt;GuestBookEntryDataSource &lt;/span&gt;ds = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntryDataSource&lt;/span&gt;();
                ds.AddGuestBookEntry(entry);
                System.Diagnostics.&lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(
&lt;span style="color: #a31515"&gt;&amp;quot;Added entry {0}-{1} in table storage for guest '{2}'&amp;quot;&lt;/span&gt;, 
entry.PartitionKey, entry.RowKey, entry.GuestName);

                &lt;span style="color: green"&gt;// queue a message to process the image
                &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;queue = queueStorage.GetQueueReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestthumbs&amp;quot;&lt;/span&gt;);
                &lt;span style="color: blue"&gt;var &lt;/span&gt;message = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudQueueMessage&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;{0},{1},{2}&amp;quot;&lt;/span&gt;, 
uniqueBlobName, entry.PartitionKey, entry.RowKey));
                queue.AddMessage(message);
                System.Diagnostics.&lt;span style="color: #2b91af"&gt;Trace&lt;/span&gt;.TraceInformation(
&lt;span style="color: #a31515"&gt;&amp;quot;Queued message to process blob '{0}'&amp;quot;&lt;/span&gt;, uniqueBlobName);
            }

            NameTextBox.Text = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;
            MessageTextBox.Text = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;

            DataList1.DataBind();
        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Timer1_Tick(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            DataList1.DataBind();
        }

        &lt;span style="color: blue"&gt;private void &lt;/span&gt;InitializeStorage()
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(storageInitialized)
            {
                &lt;span style="color: blue"&gt;return&lt;/span&gt;;
            }

            &lt;span style="color: blue"&gt;lock &lt;/span&gt;(gate)
            {
                &lt;span style="color: blue"&gt;if &lt;/span&gt;(storageInitialized)
                {
                    &lt;span style="color: blue"&gt;return&lt;/span&gt;;
                }

                &lt;span style="color: blue"&gt;try
                &lt;/span&gt;{
                    &lt;span style="color: green"&gt;// Create a new instance of a CloudStorageAccount object from a specified configuration setting. 
                    // This method may be called only after the SetConfigurationSettingPublisher 
                    // method has been called to configure the global configuration setting publisher.
                    // You can call the SetConfigurationSettingPublisher method in the OnStart method
                    // of the web role or in the Application_Start method in the Global.asax.cs file.
                    // If you do not do this, the system raises an exception 
                    &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;storageAccount = 
                    &lt;span style="color: #2b91af"&gt;CloudStorageAccount&lt;/span&gt;.FromConfigurationSetting(&lt;span style="color: #a31515"&gt;&amp;quot;DataConnectionString&amp;quot;&lt;/span&gt;);

                    &lt;span style="color: green"&gt;// create blob container for images
                    &lt;/span&gt;blobStorage = storageAccount.CreateCloudBlobClient();
                    &lt;span style="color: #2b91af"&gt;CloudBlobContainer &lt;/span&gt;container = 
                    blobStorage.GetContainerReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestbookpics&amp;quot;&lt;/span&gt;);
                    container.CreateIfNotExist();

                    &lt;span style="color: green"&gt;// configure container for public access
                    &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;permissions = container.GetPermissions();
                    permissions.PublicAccess = 
                        &lt;span style="color: #2b91af"&gt;BlobContainerPublicAccessType&lt;/span&gt;.Container;
                    container.SetPermissions(permissions);

                    &lt;span style="color: green"&gt;// create queue to communicate with worker role
                    &lt;/span&gt;queueStorage = storageAccount.CreateCloudQueueClient();
                    &lt;span style="color: #2b91af"&gt;CloudQueue &lt;/span&gt;queue = 
                        queueStorage.GetQueueReference(&lt;span style="color: #a31515"&gt;&amp;quot;guestthumbs&amp;quot;&lt;/span&gt;);
                    queue.CreateIfNotExist();
                }
                &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WebException&lt;/span&gt;)
                {
                
                    &lt;span style="color: #2b91af"&gt;StringBuilder &lt;/span&gt;buffer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();
                    buffer.Append(&lt;span style="color: #a31515"&gt;&amp;quot;Storage services initialization failure.&amp;quot;&lt;/span&gt;);
                    buffer.Append(&lt;span style="color: #a31515"&gt;&amp;quot; Check your storage account configuration settings.&amp;quot;&lt;/span&gt;);
                    buffer.Append(&lt;span style="color: #a31515"&gt;&amp;quot; If running locally,&amp;quot;&lt;/span&gt;);
                    buffer.Append(&lt;span style="color: #a31515"&gt;&amp;quot; ensure that the Development Storage service is running.&amp;quot;&lt;/span&gt;);

                    &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebException&lt;/span&gt;(buffer.ToString());
                       
                }

                storageInitialized = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
            }
        }
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;h5&gt;To configure the storage account for the web role&lt;/h5&gt;

&lt;p&gt;In order for the web role to use the Windows Azure storage services, you must provide account settings as shown next.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt;, expand the Role node in the &lt;b&gt;GuestBook&lt;/b&gt; project. &lt;/li&gt;

  &lt;li&gt;Double click &lt;b&gt;GuestBook_WebRole&lt;/b&gt; to open the properties for this role and select &lt;b&gt;Settings&lt;/b&gt; tab. &lt;/li&gt;

  &lt;li&gt;Click &lt;b&gt;Add Settings&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Name&lt;/b&gt; column, enter &lt;i&gt;DataConnectionString&lt;/i&gt;. &lt;/li&gt;

  &lt;li&gt;12. In the &lt;b&gt;Type&lt;/b&gt; column from the drop-down list select &lt;i&gt;ConnectionString&lt;/i&gt;. &lt;/li&gt;

  &lt;li&gt;13. In the &lt;b&gt;Value&lt;/b&gt; column, from the drop-down list, select &lt;i&gt;Use development storage&lt;/i&gt;. &lt;/li&gt;

  &lt;li&gt;14. Click &lt;b&gt;OK&lt;/b&gt;. Then press Ctrl+S to save your changes. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0675.image_5F00_25D621DD.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2248.image_5F00_thumb_5F00_4B5F9F3E.png" width="449" height="297" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Figure 6 Configuring Storage Account For Web Role &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A storage account is a unique end- point for Windows Azure blob, queue and table services. You must create a storage account to use these services. For more information, see &lt;a href="http://www.microsoft.com/windowsazure/offers/"&gt;Windows Azure Platform&lt;/a&gt;.&amp;#160; &lt;/p&gt;

&lt;p&gt;This walkthrough uses the development storage included in the Windows Azure SDK development environment to simulate blob, queue, and table services available in the cloud. Windows Azure by default uses SQL Server Express to simulate these services. You can also use a local instance of the SQL Server. To do so you must define the connection string that the development storage can use to connect to the server. For more information, see &lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/01/using-windows-azure-development-environment-essentials.aspx"&gt;Using Windows Azure Development Environment Essentials&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;
  &lt;table style="background-color: #c0c0c0; cellpading: 0"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;p&gt;&lt;em&gt;To use the development storage, you set the value of the &lt;b&gt;UseDevelopmentStorage&lt;/b&gt; keyword in the connection string for the storage account to &lt;b&gt;true&lt;/b&gt;. When you deploy your application to Windows Azure, you need to update the connection string to specify storage account settings including your account name and shared key. For example, 

              &lt;br /&gt;&lt;em&gt;&amp;lt;Setting name=&amp;quot;DataConnectionString&amp;quot; value=&amp;quot;DefaultEndpointsProtocol=https;AccountName=YourAccountName;AccountKey=YourAccountKey&amp;quot; /&amp;gt; &lt;/em&gt;&lt;/em&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;For related topics, see the following posts.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt;. &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6:&amp;#160; Service Configuration&lt;/a&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx"&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10110449" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Building Windows Azure Service Part3: Table Storage</title><link>http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx</link><pubDate>Sun, 26 Dec 2010 22:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10109159</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10109159</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx#comments</comments><description>&lt;p&gt;This post shows how to create a project that contains the classes to store guest entries in &lt;b&gt;Windows Azure Table Storage&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;The &lt;b&gt;Table Storage&lt;/b&gt; service offers semi-structured storage in the form of tables that contain collections of entities. Entities have a primary key and a set of properties, where a property is a (name, typed-value) pair. The &lt;b&gt;Table Storage&lt;/b&gt; service primary key has the following two properties: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;PartitionKey&lt;/b&gt; and &lt;b&gt;RowKey&lt;/b&gt; keys that uniquely identify each entity in the table. &lt;/li&gt;    &lt;li&gt;Every entity in the Table Storage service also has a &lt;strong&gt;Timestamp&lt;/strong&gt; system property, which allows the service to keep track of when an entity was last modified. This &lt;b&gt;Timestamp&lt;/b&gt; field is intended for system use and should not be accessed by the application. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Table Storage API provides a &lt;b&gt;TableServiceEntity&lt;/b&gt; class that defines the necessary properties, which you can use as the base class for your entities. This API is compliant with the REST API provided by Data Services and allows you to use the.&lt;a href="http://msdn.microsoft.com/en-us/data/bb931106"&gt;NET Client Library for Data Services&lt;/a&gt; to work with data in the Table service using .NET objects.&lt;/p&gt;  &lt;p&gt;   &lt;table style="background-color: #c0c0c0; cellpading: 0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;&lt;em&gt;Although the Table Storage does not enforce any schema for tables, which makes it possible for two entities in the same table to have different sets of properties, the &lt;strong&gt;GuestBook&lt;/strong&gt; application uses a fixed schema to store its data.&lt;/em&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;In order to use the.NET Client Library for Data Services to access the data in Table Storage, you need to create a context class that derives from &lt;b&gt;TableServiceContext&lt;/b&gt;, which itself derives from &lt;b&gt;DataServiceContext&lt;/b&gt; in .NET Client Library for Data Services . &lt;/p&gt;  &lt;p&gt;The Table Storage API allows applications to create the tables from the context class. For this to happen, the context class must expose each required table as a property of type &lt;b&gt;IQueryable&amp;lt;&lt;i&gt;SchemaClass&lt;/i&gt;&amp;gt;&lt;/b&gt;, where &lt;b&gt;&lt;i&gt;SchemaClass&lt;/i&gt;&lt;/b&gt; is the class that models the entities stored in the table.&lt;/p&gt;  &lt;p&gt;In this post, you will perform the following tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx#dataModelProject"&gt;Create the data model project&lt;/a&gt; to contain the classes to store guest entries. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx#schemaClass"&gt;Create a schema class&lt;/a&gt; for the entities stored by the GuestBook application. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx#contextClass"&gt;Create a context class&lt;/a&gt; to use .NET Client Library for Data Services to access the data in Table Storage. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx#dataSourceClass"&gt;Create a data source class&lt;/a&gt; that enables the creation of a data source object. The data source object can be bound to ASP.NET data controls which enable the user to access the Table Storage data. &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;To create the data model project&lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;In &lt;b&gt;Solution Explorer&lt;/b&gt; dialog right-click the GuestBook solution and select &lt;b&gt;New Project&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Add New Project &lt;/b&gt;dialog window, choose the &lt;b&gt;Windows&lt;/b&gt; category. &lt;/li&gt;    &lt;li&gt;Select &lt;b&gt;Class Library&lt;/b&gt; in the templates list. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Name &lt;/b&gt;box enter the &lt;b&gt;GuestBook_Data&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Click &lt;b&gt;OK&lt;/b&gt;.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8156.image_5F00_402A745B.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/4530.image_5F00_thumb_5F00_2F62C9AD.png" width="421" height="282" /&gt;&lt;/a&gt; &lt;/p&gt;     &lt;strong&gt;Figure 5 Creating the Data Model Project&lt;/strong&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;In Solution Explorer right-click the &lt;strong&gt;GuestBook_Data&lt;/strong&gt; project. &lt;/li&gt;    &lt;li&gt;Select &lt;strong&gt;Add Reference&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;strong&gt;Add Reference &lt;/strong&gt;window dialog select &lt;strong&gt;.NET&lt;/strong&gt; tab. &lt;/li&gt;    &lt;li&gt;Add reference to &lt;strong&gt;System.Data.Services.Client.&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;Repeat the previous steps to add a reference to&lt;strong&gt; Microsoft.WindowsAzure.StorageClient&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Delete the default Class1.cs generated by the template. &lt;/li&gt; &lt;/ol&gt;  &lt;h5&gt;To create the schema class&lt;/h5&gt;  &lt;p&gt;This section shows how to create the class that defines the schema for the GuestBook table entries. Its parent class &lt;b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.tableserviceentity.aspx"&gt;Microsoft.WindowsAzure.StorageClient.TableServiceEntity&lt;/a&gt;&lt;/b&gt; defines the properties required by every entity stored in a Windows Azure table.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Right-click the &lt;b&gt;GuestBookData&lt;/b&gt; project, click &lt;b&gt;Add New item&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Add New Item&lt;/b&gt; dialog window, select the &lt;b&gt;Code&lt;/b&gt; category. &lt;/li&gt;    &lt;li&gt;In the templates list select &lt;b&gt;Class&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the Name box enter &lt;b&gt;GuestBookEntry.cs&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Click &lt;b&gt;Add&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Open the &lt;b&gt;GuestBookEntry.cs&lt;/b&gt; file and replace its content with the following code. &lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.StorageClient;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;GuestBook_Data
{
    &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;The GuestBookEntry class defines the schema for each entry (row) 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;of the guest book table that stores guest information.
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;remarks&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;The parent class TableServiceEntity defines the properties required 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;by every entity that uses the Windows Azure Table Services. These      
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;properties include PartitionKey and RowKey.
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/remarks&amp;gt;
    /// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntry &lt;/span&gt;:
        Microsoft.WindowsAzure.StorageClient.&lt;span style="color: #2b91af"&gt;TableServiceEntity
    &lt;/span&gt;{
        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Create a new instance of the GuestBookEntry class and 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;initialize the requires keys.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;GuestBookEntry()
        {
            &lt;span style="color: green"&gt;// The partition key allows partitioning the data so that
            // there is a separate partition for each day of guest 
            // book entries. The partition key is used to assure 
            // load balancing for data access across fabric nodes (servers).
            &lt;/span&gt;PartitionKey = &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.UtcNow.ToString(&lt;span style="color: #a31515"&gt;&amp;quot;MMddyyyy&amp;quot;&lt;/span&gt;);

            &lt;span style="color: green"&gt;// Row key allows sorting, this assures the rows are 
            // returned in time order.
            &lt;/span&gt;RowKey = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;{0:10}_{1}&amp;quot;&lt;/span&gt;,
                &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.MaxValue.Ticks - &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.Now.Ticks, &lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid());
        }

        &lt;span style="color: green"&gt;// Define the properties that contain guest information.
        &lt;/span&gt;&lt;span style="color: blue"&gt;public string &lt;/span&gt;Message { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;GuestName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;PhotoUrl { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;ThumbnailUrl { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h5&gt;To create the context class&lt;/h5&gt;

&lt;p&gt;This section shows how to create the context class that enables Windows Azure Table Storage services. Its parent class &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.tableservicecontext.aspx"&gt;Microsoft.WindowsAzure.StorageClient.TableserviceContext&lt;/a&gt;&lt;b&gt;&lt;/b&gt; manages the credentials required to access your account and provides support for a retry policy for update operations. &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Right-click the &lt;b&gt;GuestBookData&lt;/b&gt; project, click &lt;b&gt;Add New item&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Add New Item&lt;/b&gt; dialog window, select the &lt;b&gt;Code&lt;/b&gt; category. &lt;/li&gt;

  &lt;li&gt;In the templates list select &lt;b&gt;Class&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the Name box enter &lt;b&gt;&lt;b&gt;GuestBookDataContext&lt;/b&gt;.cs&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;Click &lt;b&gt;Add&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;Open the &lt;b&gt;&lt;b&gt;GuestBookDataContext&lt;/b&gt;.cs&lt;/b&gt; file and replace its content with the following code. &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.StorageClient;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;GuestBook_Data
{
    &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;The GuestBookDataContext class enables Windows 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;Azure Table Services.
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;remarks&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;The parent class TableserviceContext manages the credentials 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;required to access account information and provides support for a 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;retry policy for update operations.
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/remarks&amp;gt; 
    /// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookDataContext &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;TableServiceContext
    &lt;/span&gt;{
        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Create an instance of the GuestBookDataContext class 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;and initialize the base
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;class with storage access information.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&amp;quot;baseAddress&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name=&amp;quot;credentials&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;GuestBookDataContext(&lt;span style="color: blue"&gt;string &lt;/span&gt;baseAddress,
            &lt;span style="color: #2b91af"&gt;StorageCredentials &lt;/span&gt;credentials)
            : &lt;span style="color: blue"&gt;base&lt;/span&gt;(baseAddress, credentials)
        { }

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Define the property that returns the GuestBookEntry table.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;GuestBookEntry&lt;/span&gt;&amp;gt; GuestBookEntry
        {
            &lt;span style="color: blue"&gt;get
            &lt;/span&gt;{
                &lt;span style="color: blue"&gt;return this&lt;/span&gt;.CreateQuery&amp;lt;&lt;span style="color: #2b91af"&gt;GuestBookEntry&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;&amp;quot;GuestBookEntry&amp;quot;&lt;/span&gt;);
            }
        }
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h5&gt;To create the data source class&lt;/h5&gt;

&lt;p&gt;This section shows how to create the data source class that allows for the creation of data source objects that can be bound to ASP.NET data controls and allow for the user to interact with the Table Storage.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Right-click the &lt;b&gt;GuestBookData&lt;/b&gt; project, click &lt;b&gt;Add New item&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the &lt;b&gt;Add New Item&lt;/b&gt; dialog window, select the &lt;b&gt;Code&lt;/b&gt; category. &lt;/li&gt;

  &lt;li&gt;In the templates list select &lt;b&gt;Class&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;In the Name box enter &lt;b&gt;&lt;b&gt;GuestBookDataSource&lt;/b&gt;.cs&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;Click &lt;b&gt;Add&lt;/b&gt;. &lt;/li&gt;

  &lt;li&gt;Open the &lt;b&gt;&lt;b&gt;GuestBookDataSource&lt;/b&gt;.cs&lt;/b&gt; file and replace its content with the following code. &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;&amp;#160;&lt;/blockquote&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.WindowsAzure.StorageClient;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;GuestBook_Data
{
    &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;The GuestBookEntryDataSource class allows for the creation of data 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;source objects that can be bound to ASP.NET data controls. These 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;controls enable the user to perform Create, Read, Update and Delete 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;(CRUD) operations. 
    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookEntryDataSource
    &lt;/span&gt;{
        &lt;span style="color: green"&gt;// Storage services account information.
        &lt;/span&gt;&lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudStorageAccount &lt;/span&gt;storageAccount;

        &lt;span style="color: green"&gt;// Context that allows the use of Windows Azure Table Services.
        &lt;/span&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookDataContext &lt;/span&gt;context;

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Initializes storage account information and creates a table 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;using the defined context.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;remarks&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;This constructor creates a table using the schema (model) 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;defined by the
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;GuestBookDataContext class and the storage account information 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;contained in the configuration connection string settings.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;Declaring the constructor static assures that the initialization 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;tasks are performed only once.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/remarks&amp;gt;
        /// &amp;lt;/summary&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;static &lt;/span&gt;GuestBookEntryDataSource()
        {
            &lt;span style="color: green"&gt;// Create a new instance of a CloudStorageAccount object from a specified configuration setting. 
            // This method may be called only after the SetConfigurationSettingPublisher 
            // method has been called to configure the global configuration setting publisher.
            // You can call the SetConfigurationSettingPublisher method in the OnStart method
            // of the web or worker role before calling FromConfigurationSetting.
            // If you do not do this, the system raises an exception.
            &lt;/span&gt;storageAccount = 
                &lt;span style="color: #2b91af"&gt;CloudStorageAccount&lt;/span&gt;.FromConfigurationSetting(&lt;span style="color: #a31515"&gt;&amp;quot;DataConnectionString&amp;quot;&lt;/span&gt;);

            &lt;span style="color: green"&gt;// Create table using the schema (model) defined by the
            // GuestBookDataContext class and the storage account information. 
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CloudTableClient&lt;/span&gt;.CreateTablesFromModel(
                &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;GuestBookDataContext&lt;/span&gt;),
                storageAccount.TableEndpoint.AbsoluteUri,
                storageAccount.Credentials);
        }

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Initialize context used to access table storage and the retry policy.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;GuestBookEntryDataSource()
        {
            &lt;span style="color: green"&gt;// Initialize context using account information.
            &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt;.context =
                &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GuestBookDataContext&lt;/span&gt;(storageAccount.TableEndpoint.AbsoluteUri,
            storageAccount.Credentials);
            &lt;span style="color: green"&gt;// Initialize retry update policy.
            &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt;.context.RetryPolicy = &lt;span style="color: #2b91af"&gt;RetryPolicies&lt;/span&gt;.Retry(3,
            &lt;span style="color: #2b91af"&gt;TimeSpan&lt;/span&gt;.FromSeconds(1));
        }

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Gets the contents of the GuestBookentry table.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        /// &amp;lt;returns&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;results: the GuestBookEntry table contents.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/returns&amp;gt;
        /// &amp;lt;remarks&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;This method retrieves today guest book entries by using the current
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;date as the partition key. The web role uses this method to 
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;bind the results to a data grid to display the guest book.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/remarks&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;GuestBookEntry&lt;/span&gt;&amp;gt; Select()
        {
            &lt;span style="color: blue"&gt;var &lt;/span&gt;results = &lt;span style="color: blue"&gt;from &lt;/span&gt;g &lt;span style="color: blue"&gt;in this&lt;/span&gt;.context.GuestBookEntry
                          &lt;span style="color: blue"&gt;where &lt;/span&gt;g.PartitionKey ==
                &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.UtcNow.ToString(&lt;span style="color: #a31515"&gt;&amp;quot;MMddyyyy&amp;quot;&lt;/span&gt;)
                          &lt;span style="color: blue"&gt;select &lt;/span&gt;g;
            &lt;span style="color: blue"&gt;return &lt;/span&gt;results;
        }

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Insert new entries in the GuestBookEntry table.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&amp;quot;newItem&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;AddGuestBookEntry(&lt;span style="color: #2b91af"&gt;GuestBookEntry &lt;/span&gt;newItem)
        {

            &lt;span style="color: blue"&gt;this&lt;/span&gt;.context.AddObject(&lt;span style="color: #a31515"&gt;&amp;quot;GuestBookEntry&amp;quot;&lt;/span&gt;, newItem);
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.context.SaveChanges();
        }

        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="color: green"&gt;Update the thumbnail URL for a table entry.
        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&amp;quot;partitionKey&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name=&amp;quot;rowKey&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name=&amp;quot;thumbUrl&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;UpdateImageThumbnail(&lt;span style="color: blue"&gt;string &lt;/span&gt;partitionKey,
            &lt;span style="color: blue"&gt;string &lt;/span&gt;rowKey, &lt;span style="color: blue"&gt;string &lt;/span&gt;thumbUrl)
        {
            &lt;span style="color: blue"&gt;var &lt;/span&gt;results = &lt;span style="color: blue"&gt;from &lt;/span&gt;g &lt;span style="color: blue"&gt;in this&lt;/span&gt;.context.GuestBookEntry
                          &lt;span style="color: blue"&gt;where &lt;/span&gt;g.PartitionKey == partitionKey &amp;amp;&amp;amp; g.RowKey ==
                rowKey
                          &lt;span style="color: blue"&gt;select &lt;/span&gt;g;

            &lt;span style="color: blue"&gt;var &lt;/span&gt;entry = results.FirstOrDefault&amp;lt;&lt;span style="color: #2b91af"&gt;GuestBookEntry&lt;/span&gt;&amp;gt;();
            entry.ThumbnailUrl = thumbUrl;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.context.UpdateObject(entry);
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.context.SaveChanges();
        }
    }
}&lt;/pre&gt;

&lt;p&gt;For related topics, see the following posts.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt;. &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6:&amp;#160; Service Configuration&lt;/a&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx"&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10109159" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Building Windows Azure Service Part2: Service Project</title><link>http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx</link><pubDate>Mon, 20 Dec 2010 01:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10107032</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10107032</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx#comments</comments><description>&lt;p&gt;In this post, you will create a Windows Azure service project using &lt;a href="http://www.microsoft.com/visualstudio/en-us/visual-studio-2010-launch?WT.srch=1&amp;amp;WT.srch=1"&gt;Microsoft Visual Studio 2010&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;&lt;a name="_Toc280448820"&gt;To create the Windows Azure service project&lt;/a&gt;&lt;/h4&gt;  &lt;ol&gt;   &lt;li&gt;From the start menu, select &lt;b&gt;All Programs&lt;/b&gt; and right-click &lt;b&gt;Microsoft Visual Studio 2010&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Choose &lt;b&gt;Run as Administrator&lt;/b&gt;.If the &lt;b&gt;User Account Control&lt;/b&gt; dialog appears, click &lt;b&gt;Continue&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;From the &lt;b&gt;File&lt;/b&gt; menu, click &lt;b&gt;New&lt;/b&gt; &lt;b&gt;Project&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;New Project&lt;/b&gt; dialog window expand the language of your choice (in this walkthrough, we are using C#) and then select &lt;b&gt;Cloud&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the templates list, select &lt;b&gt;Windows Azure Cloud Service&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Name&lt;/b&gt; box, enter &lt;b&gt;GuestBook&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;Location&lt;/b&gt; box, enter the location where to store the project. &lt;/li&gt;    &lt;li&gt;Click &lt;b&gt;OK&lt;/b&gt; to create the project.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/4786.image_5F00_3A8ACF7D.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; float: ; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5543.image_5F00_thumb_5F00_0BE4A0CE.png" width="461" height="313" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;      &lt;p&gt;&lt;strong&gt;Figure 2 Creating Windows Azure Service Project&lt;/strong&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;In the &lt;b&gt;New Cloud Service Project&lt;/b&gt; dialog window, in the &lt;b&gt;.NET Framework Roles &lt;/b&gt;panel select &lt;b&gt;ASP.NET Web Role&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Click the right arrow to add an instance of the selected role to the solution. &lt;/li&gt;    &lt;li&gt;The role shows in the &lt;b&gt;Cloud Service Solution&lt;/b&gt; right panel. &lt;/li&gt;    &lt;li&gt;Click the pencil icon. &lt;/li&gt;    &lt;li&gt;Rename the role &lt;b&gt;GuestBook_WebRole&lt;/b&gt;. &lt;/li&gt;    &lt;li&gt;Click &lt;b&gt;OK&lt;/b&gt; to create the cloud service solution.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/6840.image_5F00_29E2AEC2.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0741.image_5F00_thumb_5F00_530A4700.png" width="503" height="263" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;      &lt;p&gt;&lt;strong&gt;Figure 3 Assigning Roles to the Service Project&lt;/strong&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;In&lt;b&gt; Solution Explorer&lt;/b&gt; review the project structure.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0741.image_5F00_378544FD.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2804.image_5F00_thumb_5F00_3925EB04.png" width="259" height="271" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;      &lt;p&gt;&lt;strong&gt;Figure 4 GuestBook Service Project Structure&lt;/strong&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;As shown in the previous illustration, the solution contains two separate projects.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;GuestBook&lt;/strong&gt; project. It contains the following files and folder:       &lt;ul&gt;       &lt;li&gt;&lt;b&gt;ServiceDefinition.csdef.&lt;/b&gt; This is the application definition file that specifies the application requirements for the Windows Azure fabric such as which roles are used, their trust level, the end points exposed by each role, the local storage requirements and the certificates used by the roles. It also defines specific application settings. The following code shows the content of the definition file. &lt;/li&gt;     &lt;/ul&gt;      &lt;blockquote&gt;       &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;encoding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;utf-8&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceDefinition &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&lt;a href="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition&amp;quot;&amp;gt;"&gt;http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition&lt;/a&gt;&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;WebRole &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook_WebRole&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;InputEndpoints&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;InputEndpoint &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;HttpIn&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;protocol&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;port&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;80&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;InputEndpoints&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DiagnosticsConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DataConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;WebRole&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;WorkerRole &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook_WorkerRole&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DiagnosticsConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DataConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;WorkerRole&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
    &lt;/blockquote&gt;

    &lt;p&gt;&amp;#160;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;b&gt;ServicesConfiguration.cscfg&lt;/b&gt;. This is the configuration file that specifies the number of instances for each role and assigns the values for the configuration settings as defined in the &lt;i&gt;ServiceDefinition.csdef&lt;/i&gt; file. The following code shows the content of the configuration file. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;blockquote&gt;
      &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceConfiguration &lt;/span&gt;&lt;span style="color: red"&gt;serviceName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Role &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook_WebRole&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Instances &lt;/span&gt;&lt;span style="color: red"&gt;count&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DiagnosticsConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;UseDevelopmentStorage=true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DataConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;UseDevelopmentStorage=true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Role&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Role &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GuestBook_WorkerRole&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Instances &lt;/span&gt;&lt;span style="color: red"&gt;count&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DiagnosticsConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;UseDevelopmentStorage=true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Setting &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DataConnectionString&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;UseDevelopmentStorage=true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigurationSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Role&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;/blockquote&gt;

    &lt;blockquote&gt;
      &lt;p&gt;The separation between service definition and configuration enables you to update the settings of a deployed application by just uploading a new service configuration file. &lt;/p&gt;
    &lt;/blockquote&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;b&gt;Roles&lt;/b&gt; node. It enables you to configure what roles the cloud service includes that are web, worker or both. It also enables you to specify which project to associate with these roles. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;blockquote&gt;
      &lt;p&gt;Adding and configuring roles in the Roles node will update the definition and configuration files.&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;

  &lt;li&gt;&lt;b&gt;GuestBook_WebRole&lt;/b&gt; project. This is a standard ASP.NET web application modified for the Windows Azure environment. It contains an additional class that provides the entry point for the web role and contains methods for initializing, starting and stopping the role. &lt;i&gt;&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For related topics, see the following posts.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx"&gt;Building Windows Azure Service Part1:&amp;#160; Introduction&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6:&amp;#160; Service Configuration&lt;/a&gt;&amp;#160;&amp;#160; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx"&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10107032" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Building Windows Azure Service Part1: Introduction</title><link>http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx</link><pubDate>Mon, 20 Dec 2010 01:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10107030</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10107030</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part1-introduction.aspx#comments</comments><description>&lt;p&gt;This is the first of several posts of a walkthrough whose goal is to &lt;strong&gt;build a cloud guest book service&lt;/strong&gt; while exploring Windows Azure basic elements . &lt;/p&gt;  &lt;p&gt;   &lt;table style="background-color: #c0c0c0; cellpading: 0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;&lt;em&gt;I wrote these posts to share my experience in learning Microsoft implementation of cloud computing. If you are new to the technology, my posts can help you to explore and learn about it.&lt;/em&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;The walkthrough demonstrates the use of Windows Azure Compute and Storage services, specifically:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Compute service: web and worker roles&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Storage service: blob, table and queues&lt;/strong&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The information presented here has been adapted from a related article published on the Channel 9 site. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_introtowindowsazurelabvs2010.aspx"&gt;Introduction to Windows Azure&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In this walkthrough you will learn how to::&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create a Windows Azure service &lt;strong&gt;using web and worker roles&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Use&lt;/strong&gt; Windows Azure &lt;strong&gt;storage services which include blobs, tables and queues&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Deploy&lt;/strong&gt; the Windows Azure service. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;A Windows Azure compute service consists of one or more web roles and worker roles.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A web role is an ASP.NET Web application accessible via an HTTP or HTTPS endpoint and is commonly the front-end for an application. &lt;/li&gt;    &lt;li&gt;A worker role is a background-processing application and is typically found in the back-end. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;A Windows Azure compute service may be comprised of one or both types of roles and can run multiple instances of each type. Windows Azure can add or remove role instances on demand allowing an application to quickly and economically scale-up or down when the need arises. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/dd179442.aspx#Subheading3"&gt;Windows Azure Compute Service&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Windows Azure storage services provide storage in the cloud, which includes blob services for storing text and binary data, table services for structured storage that can be queried, and queue services for reliable and persistent messaging between services. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/dd179442.aspx#Subheading2"&gt;Windows Azure Storage Services&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The following illustration shows the architecture of the Windows Service, called &lt;b&gt;GuestBook,&lt;/b&gt; that you are going to build during this exercise . &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0825.GuestBookArchitecture_5F00_6FDC3DAC.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GuestBookArchitecture" border="0" alt="GuestBookArchitecture" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0245.GuestBookArchitecture_5F00_thumb_5F00_54C36E9E.png" width="434" height="221" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 1 GuestBook Application Architecture&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A web role provides the front-end that enables the user to view the contents of the guest book and submit new entries. Each entry contains a name, a message, and an associated picture. &lt;/li&gt;    &lt;li&gt;A worker role that generates thumbnails for the pictures submitted by the user. &lt;/li&gt;    &lt;li&gt;When the user posts a new item, the web role uploads the picture to the blob storage and creates a new entry in the table storage. The entry contains the information entered by the user and a link to the blob with the picture. The web role renders this information through the browser so users can view the contents of the guest book. &lt;/li&gt;    &lt;li&gt;After storing the image and creating the entry, the web role posts a work item to a queue to have the image processed in the back-end by the worker role. &lt;/li&gt;    &lt;li&gt;The worker role fetches the work item from the queue, retrieves the image from the blob storage, and resizes it to create a thumbnail. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;What we have described is a common pattern in cloud computing which enables the separation of compute-bound tasks from the front-end ones by using queues. The advantage of this approach is that front and back end can be scaled independently. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc280448818"&gt;Prerequisites&lt;/a&gt;&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;The Windows Azure Tools for Microsoft Visual Studio are available on the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=128752"&gt;Windows Azure Tools for Microsoft Visual Studio download page&lt;/a&gt;. The Windows Azure SDK is included with the installation, so there is no need to install the SDK separately. &lt;/li&gt;    &lt;li&gt;You can also install the Windows Azure Tools using the &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;Microsoft Web Platform Installer&lt;/a&gt;. The Web Platform Installer simplifies the process of installing and configuring IIS, the Windows Azure SDK, and the Windows Azure Tools. &lt;/li&gt;    &lt;li&gt;The Windows Azure Tools can be used with these Microsoft products:      &lt;ul&gt;       &lt;li&gt;Visual Studio 2010 &lt;/li&gt;        &lt;li&gt;Visual Web Developer 2010 Express Edition &lt;/li&gt;        &lt;li&gt;Visual Studio 2008 with Service Pack 1 &lt;/li&gt;        &lt;li&gt;Visual Web Developer 2008 Express Edition with Service Pack 1 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/ee405484.aspx"&gt;Windows Azure Tools for Microsoft Visual Studio&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;For related topics, see the following posts.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/20/walkthrough-windows-azure-service-part2-creating-the-service-project.aspx"&gt;Building Windows Azure Service Part2:&amp;#160; Service Project&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/26/building-windows-azure-service-part3-table-storage.aspx"&gt;Building Windows Azure Service Part3:&amp;#160; Table Storage&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2010/12/30/building-windows-azure-service-part4-web-role-ui-handler.aspx"&gt;Building Windows Azure Service Part4:&amp;#160; Web Role UI Handler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/01/building-windows-azure-service-part5-worker-role-background-tasks-handler.aspx"&gt;Building Windows Azure Service Part5:&amp;#160; Worker Role Background Tasks Handler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part6-service-configuration.aspx"&gt;Building Windows Azure Service Part6:&amp;#160; Service Configuration&lt;/a&gt;&amp;#160; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/morebits/archive/2011/01/05/building-windows-azure-service-part7-service-testing.aspx"&gt;Building Windows Azure Service Part7:&amp;#160; Service Testing&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10107030" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Using Windows Azure Development Environment Essentials</title><link>http://blogs.msdn.com/b/morebits/archive/2010/12/01/using-windows-azure-development-environment-essentials.aspx</link><pubDate>Wed, 01 Dec 2010 02:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10098703</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10098703</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/12/01/using-windows-azure-development-environment-essentials.aspx#comments</comments><description>&lt;p&gt;The Windows Azure development is a simulation environment which enables you to run and debug your applications (services) before deploying them. The development environment provides the following utilities:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;b&gt;development fabric&lt;/b&gt; utility. The development fabric is a simulation environment for running your application (service) locally, for testing and debugging it before deploying it to the cloud. The fabric handles the lifecycle of your role instances, as well as providing access to simulated resources such as local storage resources. &lt;/li&gt;    &lt;li&gt;The &lt;b&gt;development storage&lt;/b&gt; utility. It simulates the Blob, Queue, and Table services available in the cloud. If you are building a hosted service that employs storage services or writing any external application that calls storage services, you can test locally against development storage. &lt;/li&gt;    &lt;li&gt;The Windows Azure SDK also provides a set of utilities for packaging your service for either the development environment or for Windows Azure, and for running your service in the development fabric&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For more information see &lt;a href="http://msdn.microsoft.com/en-us/library/ff800695.aspx"&gt;Using the Windows Azure Development Environment&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Development Fabric&lt;/h4&gt;  &lt;p&gt;Before using the Windows Azure development environment, you must assure that it is activated. Usually this happens when you start debugging your application in Visual studio. You can verify the activation by checking that the related icon exists in the system tray as shown in the following illustration.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8255.clip_5F00_image001_5F00_6DBF0161.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/4861.clip_5F00_image001_5F00_thumb_5F00_6CE69B77.png" width="168" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 1 Windows Azure Development Environment Icon&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Note. Using the CSRun command-line tool starts the development fabric if it is not yet running. You must run this tool as an administrator. For more information see &lt;a href="http://msdn.microsoft.com/en-us/library/dd179412.aspx"&gt;CSRun Command-Line Tool&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;You can right-click this icon to display the user interfaces for the development fabric and development storage and to start or shut down these services.&lt;/p&gt;  &lt;p&gt;1. Right-click the icon and in the pop-up dialog click &lt;b&gt;Show Development Fabric UI&lt;/b&gt;. A development fabric UI window is activated similar to the one shown in the following illustration. The development fabric UI shows your service deployments in an interactive format. You can examine the configuration of a service, its roles, and its role instances. From the UI, you can run, suspend, or restart a service. In this way, you can verify the basic functionality of your service.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/6523.clip_5F00_image003_5F00_1EF371ED.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/3173.clip_5F00_image003_5F00_thumb_5F00_2BED51FE.jpg" width="530" height="398" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 2 Development Fabric UI&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;2. Right-click the icon and in the pop-up dialog click &lt;b&gt;Show Development Storage UI&lt;/b&gt;. A development storage UI window is activated similar to the one shown in the following illustration. You can use the development storage UI to start or stop any of the services, or to reset them. Resetting a service stops the service, cleans all data for that service from the SQL database (including removing any existing blobs, queues, or tables), and restarts the service.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0336.clip_5F00_image004_5F00_162369A1.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2577.clip_5F00_image004_5F00_thumb_5F00_62E73037.png" width="501" height="174" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 3 Development Storage UI&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;Development Storage &lt;/h4&gt;  &lt;p&gt;The development storage relies on a Microsoft SQL Server instance to simulate the storage servers. By default, the development storage is configured for Microsoft SQL Server Express versions 2005 or 2008. Also development storage uses Windows authentication to connect to the server. &lt;/p&gt;  &lt;p&gt;Using the CSRun command-line tool automatically starts development storage. You can also use this command to stop development storage. The first time you run development storage, an initialization process runs to configure the environment. The initialization process creates a database in SQL Server Express and reserves HTTP ports for each local storage service.&lt;/p&gt;  &lt;h4&gt;Configuring Microsoft SQL Server &lt;/h4&gt;  &lt;p&gt;You can also configure the development storage to access a local instance of SQL Server different from the default SQL Server Express. You can do that by running the DSInit.exe command-line tool as shown next. Remember you must run this tool as an administrator. For more information see &lt;a href="http://msdn.microsoft.com/en-us/library/dd179457.aspx"&gt;DSInit Tool&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;1. In the Windows Azure SDK command prompt execute the following command as shown in the next illustration: &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;gt;dsinit /sqlinstance:. &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/7183.clip_5F00_image006_5F00_6C5FEEAD.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2084.clip_5F00_image006_5F00_thumb_5F00_60CA316E.jpg" width="547" height="183" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 4 Initializing Development Environment Storage&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;2. A dialog prompt is displayed similar to the one shown in the next illustration.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/3482.clip_5F00_image008_5F00_593EC201.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0456.clip_5F00_image008_5F00_thumb_5F00_1F4F7F15.jpg" width="435" height="334" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 5 Confirming Development Environment Storage Initialization&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The initialization process creates a database named &lt;b&gt;DevelopmentStorageDb20090919&lt;/b&gt;&lt;b&gt; &lt;/b&gt;in your current SQL Server default instance and reserves HTTP ports for each local storage service. &lt;/p&gt;  &lt;p&gt;3. Click &lt;b&gt;OK&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;You can view the created database by using &lt;b&gt;Microsoft SQL Server Management Studio&lt;/b&gt; as shown in the following illustration. The tool can be downloaded from this location: &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b"&gt;Microsoft SQL Server 2008 Management Studio Express&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/3580.clip_5F00_image010_5F00_7E5C0C6D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0246.clip_5F00_image010_5F00_thumb_5F00_08AD30CE.jpg" width="571" height="363" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 6 Displaying Development Environment Storage Database&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;Connecting to Microsoft SQL Server&lt;/h4&gt;  &lt;p&gt;This section shows you how to connect to your own Microsoft SQL server instance. To do that you need to configure the connection string that development storage can use. The following steps show how to do this. &lt;/p&gt;  &lt;p&gt;The first thing you want to do is to obtain the actual connection string to use.&lt;/p&gt;  &lt;p&gt;1. Activate Visual Studio as an administrator then select &lt;b&gt;Server Explorer&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;2. Right-click &lt;b&gt;Data Connections&lt;/b&gt; and then select click &lt;b&gt;Add Connection…&lt;/b&gt; as shown in the following illustration.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8360.clip_5F00_image011_5F00_27EFD7A1.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image011" border="0" alt="clip_image011" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0841.clip_5F00_image011_5F00_thumb_5F00_432830A2.png" width="457" height="314" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 7 Creating Development Environment Storage Database Server Connection&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;3. In the displayed dialog window, in the &lt;b&gt;Server name&lt;/b&gt; box enter the name of your SQL server (by default, it is the name of your machine).&lt;/p&gt;  &lt;p&gt;4. In the &lt;b&gt;Log on to the server&lt;/b&gt;, leave &lt;b&gt;Use Windows Authentication&lt;/b&gt; selected. This is the authentication modality used by development storage.&lt;/p&gt;  &lt;p&gt;5. In the &lt;b&gt;Connect to a database&lt;/b&gt; check &lt;b&gt;Select or enter a database name&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;6. In the drop-down list select the development storage database &lt;b&gt;DevelopmentStorageDb20090919&lt;/b&gt;. The following illustration is an example of these steps.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5040.clip_5F00_image013_5F00_01AD7E49.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image013" border="0" alt="clip_image013" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/1004.clip_5F00_image013_5F00_thumb_5F00_39EBF561.jpg" width="327" height="477" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 8 Specifying Development Environment Storage Database&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;7. Click &lt;b&gt;Test Connection&lt;/b&gt;. If everything is correct, a successful pop-up dialog is displayed. Click &lt;b&gt;OK&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;8. Finally, Click &lt;b&gt;OK&lt;/b&gt; in the main dialog window. &lt;/p&gt;  &lt;p&gt;A new database connection, similar to the one shown in the following illustration, is created and displayed in &lt;b&gt;Server Explorer&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/7752.clip_5F00_image014_5F00_04070047.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8357.clip_5F00_image014_5F00_thumb_5F00_5136F9D2.png" width="289" height="304" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 9 Development Storage Database Connection&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;9. Right-click the data connection just created and in the pop-up dialog select &lt;b&gt;Properties&lt;/b&gt;.&lt;/p&gt;  &lt;p&gt;10. In the &lt;b&gt;Properties&lt;/b&gt; window copy the &lt;b&gt;Connection String&lt;/b&gt; property value that is similar to this: &lt;/p&gt;  &lt;p&gt;&lt;i&gt;Data Source=mmieleLAPTOP;Initial Catalog=DevelopmentStorageDb20090919;Integrated Security=True &lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Among other things, the string defines the name of the SQL server instance and the development storage database. &lt;/p&gt;  &lt;p&gt;Now you need to instruct development storage to use this connection string to connect to the database. You do this by following the next steps.&lt;/p&gt;  &lt;p&gt;11. In Visual Studio open the file &lt;i&gt;C:\Program Files\Windows Azure SDK\v1.2\bin\devstore\dsservice.exe.config&lt;/i&gt;. Remember that you must activate Visual Studio as an administrator.&lt;/p&gt;  &lt;p&gt;12. In the &lt;b&gt;&amp;lt;configuration&amp;gt;&lt;/b&gt; element create a &lt;b&gt;&amp;lt;connectionStrings&amp;gt;&lt;/b&gt; section.&lt;/p&gt;  &lt;p&gt;13. In the section just created enter an &lt;b&gt;&amp;lt;add&amp;gt;&lt;/b&gt; element.&lt;/p&gt;  &lt;p&gt;14. To the &lt;b&gt;name&lt;/b&gt; attribute assign the value &lt;i&gt;DevelopmentStorageDbConnectionString.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;15. To the &lt;b&gt;connectionString&lt;/b&gt; attribute assign the connection string evaluated in the previous steps. &lt;/p&gt;  &lt;p&gt;The following is an example of these connection string settings.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;connectionStrings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DevelopmentStorageDbConnectionString&lt;/span&gt;&amp;quot;
         &lt;span style="color: red"&gt;connectionString&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Data Source=mmielelaptop;Initial Catalog=DevelopmentStorageDb20090919;Integrated Security=True&lt;/span&gt;&amp;quot;
         &lt;span style="color: red"&gt;providerName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;System.Data.SqlClient&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;connectionStrings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Notice that development storage expects the &lt;b&gt;name&lt;/b&gt; attribute to be &lt;i&gt;DevelopmentStorageDbConnectionString&lt;/i&gt;&lt;b&gt;.&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;16. Save and close the file.&lt;/p&gt;

&lt;p&gt;You have configured development storage to use your own instance of the SQL server instead of the default SQL Express server.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10098703" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item><item><title>Getting Started With Silverlight</title><link>http://blogs.msdn.com/b/morebits/archive/2010/10/26/getting-started-with-silverlight.aspx</link><pubDate>Tue, 26 Oct 2010 14:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10080956</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10080956</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/10/26/getting-started-with-silverlight.aspx#comments</comments><description>&lt;p&gt;Silverlight is a .NET Framework &lt;b&gt;development platform&lt;/b&gt; for creating rich interactive applications (RIA) for web, desktop, and mobile platforms when online or offline. Silverlight also provides a &lt;b&gt;free plug-in&lt;/b&gt; compatible with multiple browsers, devices and operating systems and supporting a new level of interactivity for applications. &lt;/p&gt;
&lt;p&gt;For more information see:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.silverlight.net/getstarted/"&gt;Getting Started with Silverlight&lt;/a&gt;. Tools and background information to start learning and building Silverlight applications.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc838158(VS.95).aspx"&gt;Silverlight&lt;/a&gt;. Conceptual and API documentation and many examples to help you understand and build your applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Silverlight Architecture&lt;/h3&gt;
&lt;p&gt;This topic describes Silverlight architecture and its components which create a powerful, lightweight platform for developing portable, cross-platform, networked applications that integrate data and services from many sources. Silverlight enables you to separate design and implementation concerns through a Model-View-ViewModel (MVVM) pattern. More specifically, you can separate your application view that is the User Interface (UI), from the business and data (back-end) logic. This model is supported by a set of tools specifically designed and integrated to support the life cycle of your application. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To build a compelling and highly interactive UI, a web designer can use &lt;a href="http://expression.microsoft.com/en-us/cc197139.aspx"&gt;Expression Studio&lt;/a&gt; which includes four design and development tools for building rich desktop and Silverlight applications for standards based web sites and streaming video. &lt;/li&gt;
&lt;li&gt;To build the business and data logic (back end), a developer can use &lt;a href="http://www.microsoft.com/visualstudio/en-us/download"&gt;Visual Studio 2010&lt;/a&gt; or &lt;a href="http://www.microsoft.com/express/Web/"&gt;Visual Web Developer 2010 Express&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As we will describe later, the tools to build the UI and the tools to build the back-end logic work together in a seamless fashion. &lt;/p&gt;
&lt;p&gt;While Silverlight offers a client-side runtime environment (browser plug-in) simple and compact in size, its development platform integrates a number of features and complex technologies. If you want to create effective Silverlight-based applications, you need a working knowledge of this platform architecture that is shown in the following illustration.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/5086.clip_5F00_image001_5F00_4D0CE161.png"&gt;&lt;img height="356" width="376" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/6866.clip_5F00_image001_5F00_thumb_5F00_0068A4BE.png" alt="clip_image001" border="0" title="clip_image001" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Fig.1 Silverlight Architecture&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;b&gt;Presentation Core&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;This layer contains the following core components to allow for the creation of powerful, interactive user interface:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;UI Core&lt;/b&gt;. It renders vector and bitmap graphics, animation and text.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Inputs&lt;/b&gt;. It handles inputs form devices such as keyboard, mouse and so on.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Media&lt;/b&gt;. It manages various audio and video files such as .WMP and .MP3 files.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;DRM&lt;/b&gt;. It enables the management of media asset digital rights.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms752059.aspx"&gt;XAML&lt;/a&gt;. The eXtensible Application Markup Language is a language for declarative application programming. Silverlight uses a subset of the Windows Presentation Foundation (WPF) types that are implemented so that they can provide the required type backing for a XAML representation. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;.&lt;strong&gt;NET Framework for Silverlight&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This layer contains components that allow for the creation of the business and data elements or the back-end of your application.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Data&lt;/b&gt;. It supports Language Integrated Query (LINQ) and LINQ to XML features which make easier to work with different data sources. It also supports the use of XML and class serialization for data handling.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms742119.aspx"&gt;Windows Presentation Foundation&lt;/a&gt; (WPF). Silverlight WPF API extends the browser UI elements. This enables you to create graphics, animation, media and other rich client features. XAML is the declarative language to create these UI elements. WPF provides a parser implementation and language support for them. You can create the majority of your application UI in Extensible Application Markup Language (XAML) markup. That is why the previous illustration shows XAML extending over both presentation and .NET Framework layers.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd456779.aspx"&gt;Windows Communication Foundation&lt;/a&gt; (WCF). It provides features to simplify access to remote services and data that include: browser object, HTTP request and response object, cross-domain HTTP requests, RSS/Atom syndication feeds, support for JSON, POX and SOAP services.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Base Class Library (BCL)&lt;/b&gt;. This is a set of .NET Framework libraries which provide essential programming support such as string handling, regular expressions, I/O, reflection, collections and globalization.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Dynamic Language Runtime (DLR)&lt;/b&gt;. It supports the dynamic compilation and execution of scripting languages such as JavaScript and IronPython for Silverlight applications. It supports a pluggable model to allow for the addition of other languages.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;b&gt;Related Technologies&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;The following technologies augment Silverlight application capabilities.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.w3schools.com/js/default.asp"&gt;JavaScript&lt;/a&gt;. Silverlight provides extensions to JavaScript to allow for controlling the browser UI and for scripting against WPF elements.&lt;/li&gt;
&lt;li&gt;o Silverlight applications run on the client machine and do not require support on the server. However, when you create your own application you may find it useful to integrate server capabilities such as:&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb515101.aspx"&gt;ASP.NET AJAX services&lt;/a&gt;. You can access most services that are used by AJAX from Silverlight applications. You do not have to change any code on the server, although you may have to change some configuration for the service on the server. These services are of two types:&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb412167.aspx"&gt;WCF AJAX&lt;/a&gt; services: These are services based on the WCF technology. They are usually identified by the presence of a characteristic ".svc" extension in their URL. These services are usually created using the &lt;strong&gt;AJAX-enabled WCF Service&lt;/strong&gt; item template in Visual Studio 2010.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb398998.aspx"&gt;ASP.NET AJAX services&lt;/a&gt;. These are services based on the ASP.NET Web Services technology. They are usually identified by the presence of a characteristic ".asmx" extension in their URL and by the use of the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=188141"&gt;System.Web.Script.Services.ScriptServiceAttribute&lt;/a&gt; and &lt;a href="http://go.microsoft.com/fwlink/?LinkId=188142"&gt;System.Web.Script.Services.ScriptMethodAttribute&lt;/a&gt; attributes.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.silverlight.net/getstarted/riaservices/"&gt;WCF RIA services&lt;/a&gt;. WCF RIA services bring together the ASP.NET and Silverlight platforms. RIA services provide a pattern to write application logic that runs on the mid-tier to control access to data for queries, changes and custom operations. It also provides support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information about how Silverlight access ASP.NET AJAX services, see &lt;a href="http://msdn.microsoft.com/en-us/library/cc197939(VS.95).aspx"&gt;Accessing ASP.NET AJAX Services&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080956" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Silverlight/">Silverlight</category></item><item><title>Getting Started With Windows Azure</title><link>http://blogs.msdn.com/b/morebits/archive/2010/10/17/starting-with-windows-azure.aspx</link><pubDate>Sun, 17 Oct 2010 18:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10077051</guid><dc:creator>michaelonmsdn</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/morebits/rsscomments.aspx?WeblogPostID=10077051</wfw:commentRss><comments>http://blogs.msdn.com/b/morebits/archive/2010/10/17/starting-with-windows-azure.aspx#comments</comments><description>&lt;h3&gt;Cloud Computing&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/windowsazure"&gt;Windows Azure Platform&lt;/a&gt; is Microsoft implementation of cloud computing. The &lt;a href="http://www.nist.gov/index.html"&gt;National Institute of Standards and Technology&lt;/a&gt; defines cloud computing as follows: &lt;/p&gt;  &lt;p&gt;&lt;i&gt;Cloud computing is a model for enabling convenient on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction. This cloud model promotes availability and is composed of five essential characteristics, three service models and four deployment models&lt;/i&gt;. &lt;/p&gt;  &lt;p&gt;For more information see &lt;a href="http://csrc.nist.gov/groups/SNS/cloud-computing/"&gt;NIST Cloud Computing&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8546.image_5F00_59294ED2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/2677.image_5F00_thumb_5F00_6B256C92.png" width="240" height="142" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Fig. 1 Accessing Cloud Computing Resources&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;h4&gt;Cloud Characteristics&lt;/h4&gt;  &lt;p&gt;On &lt;b&gt;demand-self-service&lt;/b&gt; is one of the cloud characteristics. It enables a consumer to provision computing resources as needed automatically, without intervention on the part of the cloud solution provider. From now on we will use the term cloud to mean cloud computing.&lt;/p&gt;  &lt;p&gt;Also a &lt;b&gt;broad network access&lt;/b&gt; allows for computing resources to be available through standard mechanisms such as HTTP and SOAP protocols. This is to enable access by a variety of clients such as laptops, mobile phones and other devices. &lt;/p&gt;  &lt;p&gt;Another important characteristic is &lt;b&gt;resource pooling&lt;/b&gt;. The cloud resources are pooled to serve multiple consumers using a multi-tenant model where resources are assigned based on consumer demand. &lt;/p&gt;  &lt;h4&gt;Cloud Service Models&lt;/h4&gt;  &lt;p&gt;The &lt;b&gt;software as a service (SaaS)&lt;/b&gt; enables the consumer to use the provider applications that run in the cloud. The applications are accessible from various client devices through a thin interface such as a web browser. An example is a web-based e-mail application.&lt;/p&gt;  &lt;p&gt;The consumer has the ability to deploy her own applications in the cloud as supported by the &lt;b&gt;platform as a service (PaaS)&lt;/b&gt; model. These applications are created using programming languages and tools supported by the provider.&lt;/p&gt;  &lt;p&gt;Finally, the &lt;b&gt;infrastructure as a service (IaaS)&lt;/b&gt; enables the consumer to provision processing, storage, networks and other computing resources to deploy and run applications. The consumer cannot control the underlying physical infrastructure, though.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/1018.image_5F00_2A16ED2E.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/6403.image_5F00_thumb_5F00_293E8744.png" width="184" height="197" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Fig.2 Service Models&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;h4&gt;Deployment Models&lt;/h4&gt;  &lt;p&gt;In the &lt;b&gt;private cloud model&lt;/b&gt; the cloud is dedicated solely to an organization. It could be managed by the organization or a third party and may be located on premise or outside.&lt;/p&gt;  &lt;p&gt;A &lt;b&gt;community cloud model &lt;/b&gt;enables several organizations to share a cloud that supports a specific community with shared needs such as security requirements, policy and compliance considerations.&lt;/p&gt;  &lt;p&gt;In the &lt;b&gt;public cloud model&lt;/b&gt; the cloud is made available to the general public or a to a large industry group. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;h4&gt;Cloud Ecosystem&lt;/h4&gt;  &lt;p&gt;The following community categories are involved in the cloud computing ecosystem:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Cloud Providers&lt;/b&gt;. They provide the hosting platform and cloud infrastructure services. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Cloud Consumers&lt;/b&gt;. They utilize the cloud platform and create applications and services for the users. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Cloud Users&lt;/b&gt;. They use the applications and services provided by the cloud consumers. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8468.image_5F00_13749EE7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/8865.image_5F00_thumb_5F00_2F55AE12.png" width="318" height="316" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Fig. 3 Cloud Computing Ecosystem&lt;/b&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;h3&gt;Cloud Architecture&lt;/h3&gt;  &lt;p&gt;The cloud architecture is structured in layers. Each layer abstracts the one below it and exposes interfaces that layers above can build upon. The layers are loosely coupled and provide horizontal scalability (they can expand) if needed. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/7317.image_5F00_6D6EC8C3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0066.image_5F00_thumb_5F00_3FA0FFFE.png" width="331" height="178" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Fig. 4 Cloud Architecture&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;As shown in the previous illustration, the cloud architecture contains several subsystems that are described next.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Hosting Platform.&lt;/b&gt; This platform provides the physical, virtual and software components. These components include servers, operating system, network, storage devices and power control and virtualization software. All these resources are abstracted as virtual resources to the layer above. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Cloud Infrastructure Services.&lt;/b&gt; The important function of this layer is to abstract the hosting platform as a set of virtual resources and to manage them based on scalability and availability. The layer provides three types of abstract resources: compute, storage and network. It also exposes a set of APIs to access and manage these resources. This enables a user to gain access to the physical resources without knowing the details of the underlying hardware and software and to control these systems through configuration. Services provided by this layer are known as Infrastructure as a Service (IaaS). &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Cloud Platform Services&lt;/b&gt;. This layer provides a set of services to help integrating on-premise software with services hosted in the cloud. For example in Windows Azure, Microsoft .NET Service Bus helps with discovery and access. Services provided by this layer are known as Platform as a Service (PaaS). &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Cloud Applications&lt;/b&gt;. This layer contains applications built for cloud computing. They expose web interfaces and services and enable multitenant hosting. Services provided by this layer are known as Software as a Service (SaaS). &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Windows Azure Platform&lt;/h3&gt;  &lt;p&gt;Windows Azure platform is the Microsoft implementation of cloud computing. The core of this platform is the Windows Azure operating system. The following illustration maps the Windows Azure platform to the cloud computing layers.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/7220.image_5F00_1002E172.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-17-43-metablogapi/0550.image_5F00_thumb_5F00_3A8E9C82.png" width="375" height="216" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Fig. 5 Windows Azure Platform Architecture&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;From now on we will use the name Windows Azure to indicate the entire platform unless we want to specifically refer to the operating system. Windows Azure provides resources and services for consumers. For example, hardware is abstracted and exposed as compute resources. Physical storage is abstracted as storage resources and exposed through very well defined interfaces. A common Windows &lt;b&gt;Fabric&lt;/b&gt; abstracts the hardware and the software and exposes virtual compute and storage resources. Each instance of an application is automatically managed and monitored for availability and scalability. If an application goes down, the Fabric is notified and a new instance of the application is created. Because virtualization is a key element in cloud computing, no assumption must be made on the state of the underlying hardware hosting the application. As matter of a fact Windows Azure follows a computing model where the Fabric controller maps service declarative specifications to available resources.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10077051" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/morebits/archive/tags/Windows+Azure/">Windows Azure</category></item></channel></rss>