<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.wintellect.com/CS/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>Paul Mehner's Blog</title><link>http://www.wintellect.com/CS/blogs/pmehner/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Comodo SSL Certificate Breach’s Potential Impact on Security Token Services and their Identity Providers</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2011/03/25/comodo-ssl-certificate-breach-s-potential-impact-on-security-token-services-and-their-identity-providers.aspx</link><pubDate>Fri, 25 Mar 2011 19:00:53 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:19697</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/19697.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=19697</wfw:commentRss><description>&lt;p&gt;Recently, Iranian crackers used a username and password to make certificate requests from the Comodo Certificate Authority. These requests were successful and certificates were issued for 9 domains which are published on the Comodo Fraud Incident Report page: &lt;a href="http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html"&gt;http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This issue is of particular importance to me because SSL is the primary mechanism by which integrity and confidentiality are assured for security Security Tokens and Security Token Requests. My latest blog post provides instructions on how to add Yahoo and Google as Identity Providers to Windows Azure AppFabric Access Control Service v2.0. The fraudulent certificates are for the major Identity Provider sources on the Internet (e.g. mail.google.com, &lt;a href="http://www.google.com/"&gt;www.google.com&lt;/a&gt;, login.yahoo.com, login.skype.com, addons.mozilla.org, login.live.com, global trustee). These certificates may be used to spoof content, perform phishing attacks, or perform man-in-the-middle attacks against all internet application users (in my view, it potentially impacts more than just applications accessible via web browsers). Although the sky is far from falling, this breach does illuminate some pretty significant vulnerabilities in our Internet security infrastructure, which need to be tightened.&lt;/p&gt;  &lt;p&gt;Revocations of your computer’s trust of these certificates can be obtained via a web browser update (which is also very unfortunate as it makes the procedure for responding to such security threats extremely cumbersome and hard to orchestrate). In short though, you (and/or your application users) must update your web browsers to gain protection. Here are a few links for popular web browsers:&lt;/p&gt;  &lt;p&gt;Microsoft IE Browser: &lt;a href="http://support.microsoft.com/kb/2524375"&gt;http://support.microsoft.com/kb/2524375&lt;/a&gt;     &lt;br /&gt;Firefox Browser: &lt;a href="http://www.mozilla.com/en-US/firefox/3.6.16/releasenotes/"&gt;http://www.mozilla.com/en-US/firefox/3.6.16/releasenotes/&lt;/a&gt;     &lt;br /&gt;Google Chrome: Tools/About (update will install automatically if you are online)     &lt;br /&gt;Apple Safari: &lt;a title="http://www.apple.com/safari/" href="http://www.apple.com/safari/"&gt;http://www.apple.com/safari/&lt;/a&gt;     &lt;br /&gt;Opera: &lt;a href="http://www.opera.com/download/"&gt;http://www.opera.com/download/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Each web browser is different, but to verify that you are protected, navigate to the certificate store of your browser and find the “Untrusted Publishers” tab (or equivalent). You want to see the list of domains above in the “Issued To” column of untrusted publishers. The following is from Internet Explorer:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_2A9E4D94.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.wintellect.com/CS/blogs/pmehner/image_thumb_4FBB9800.png" width="460" height="424" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Please notice that there are only EIGHT certificates in the revocation list. I am puzzled as to why the “www.google.com” certificate is missing; however more information was not readily available at the time I wrote this blog post.&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=19697" width="1" height="1"&gt;</description></item><item><title>Programmatically Adding Google or Yahoo as an Identity Provider to the Windows Azure AppFabric Labs v2.0 Access Control Service</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2011/03/22/programmatically-adding-google-or-yahoo-as-an-identity-provider-to-the-windows-azure-appfabric-labs-v2-0-access-control-service.aspx</link><pubDate>Tue, 22 Mar 2011 06:26:21 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:19685</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/19685.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=19685</wfw:commentRss><description>&lt;p&gt;This blog post assumes that the reader knows the basics of Identity Providers and Security Token Services. Its purpose is to illustrate how to programmatically add Google or Yahoo as an Identity Provider because there isn’t much information available on how to do this. For further information about using the ManagementServices proxy, I suggest downloading the Codeplex ACS Management examples from &lt;a href="http://acs.codeplex.com/releases/view/57595"&gt;http://acs.codeplex.com/releases/view/57595&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We manage the Windows Azure AppFabric Access Control Service v2.0 through code using the ManagementService proxy and data types which are generated when we add a service reference to the ACS Metadata endpoint located at https://{yournamespace}.accesscontrol.appfabriclabs.com/v2/mgmt/service, You can do this using either the Visual Studio “Add Service Reference” menu option, or manually using the svcutil.exe utility. There are examples of this in the code samples mentioned above. &lt;/p&gt;  &lt;p&gt;To begin, we will use the management service proxy to retrieve a list of the IdentityProviders that have already been installed for the targeted namespace. By default, Windows Live ID will already be present and cannot be removed. The management service API requires that all requests be accompanied by a SWT token, which is also covered in the previously mentioned code samples.&lt;/p&gt;  &lt;p&gt;To create a new IdentityProvider, we need to establish an Issuer for tokens coming from that Identity. To do this, we create a new instance of the “Issuer” type and initialize its Name property to “Google”. This “friendly name” will appear in the ACS Management portal UI. We can then add that type to the management Issuer’s collection and save our changes. This will generate a new Id for the Issuer. We can then create an instance of IdentityProvider. Set the DisplayName and Description to appropriate values for display in the ACS Management Portal. Set the WebSSOProtocolType to “OpenId” and the IssuerId to the Id property of the Issuer that we just created and saved.&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;"&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;font-family:;background-position:0% 0%;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;// ms is an instance of ManagementService proxy&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Issuer&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt; issuer = &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;Issuer&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; { Name = &lt;/font&gt;&lt;/span&gt;&lt;font color="#c0504d"&gt;“Google”&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; };&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.AddToIssuers(issuer);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.SaveChanges(&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;SaveChangesOptions&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;.Batch);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// Create Identity Provider&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;IdentityProvider&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt; identityProvider = &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;IdentityProvider&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;DisplayName = &lt;font color="#c0504d"&gt;“Google”&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;Description = &lt;font color="#c0504d"&gt;“Google”&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;WebSSOProtocolType = &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#c0504d"&gt;“OpenId”,&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;IssuerId = issuer.Id&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;};&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.AddObject(&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#a31515"&gt;&amp;quot;IdentityProviders&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family:;mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;, identityProvider);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;We need a means for the token requestor and consuming applications to verify the authenticity of tokens issued by the STS. The STS publishes the base64 encoded public key of the certificate that it will use to digitally sign its tokens in the metadata exchange document. We will set the appropriate IdentityProviderKey properties to the certificate values and then we’ll add the IdentityProviderKey object to our object graph and associate it with the IdentityProvider that will use it as shown in the following code:&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;   &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;// *** Create the Identity Provider key used to validate&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // the signature &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;of IDP-signed tokens. Signing certificates&lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;"&gt;// can be found in a WSFederation IDP's metadata. &lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;IdentityProviderKey&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt; identityProviderKey = &lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;IdentityProviderKey&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;DisplayName = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#a31515"&gt;&amp;quot;GoogleIdentityProviderKeyDisplayName&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;Type = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#c00000"&gt;“X509Certificate”&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;Usage = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#c00000"&gt;“Signing”&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;Value = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;Convert&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;.FromBase64String(&lt;/font&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#a31515"&gt;&amp;quot;MIIB9DCCAWGgAwI…”&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;),&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;IdentityProvider = identityProvider,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;StartDate = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;.UtcNow,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;EndDate = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;.UtcNow.AddYears(1);,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;};&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.AddRelatedObject(identityProvider, &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font color="#a31515"&gt;&amp;quot;IdentityProviderKeys&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;, identityProviderKey);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span style="mso-fareast-font-family:'Times New Roman';"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font style="font-size:11pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;Our new Google or Yahoo IdentityProvider will need to have an endpoint address associated with it. We can do this by creating an instance of the IdentityProviderAddress class and adding it to the entity data model then saving our changes. There are two properties on this class with values that are less than obvious (or even discoverable).&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;The Address property of the endpoint address instance must be set to &lt;a href="https://www.google.com/accounts/o8/ud"&gt;https://www.google.com/accounts/o8/ud&lt;/a&gt; and the EndpointType must be to “SignIn”.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; F&lt;/span&gt;or Yahoo, set the Address property to &lt;a href="https://open.login.yahooapis.com/openid/op/auth"&gt;https://open.login.yahooapis.com/openid/op/auth&lt;/a&gt; and the EndpointType to “SignIn”.&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;IdentityProviderAddress&lt;span&gt; googleRealm = &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&lt;span&gt;&amp;#160;&lt;/span&gt;IdentityProviderAddress&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;() {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;Address = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;https://www.google.com/accounts/o8/ud&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;EndpointType = &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#c00000"&gt;“SignIn”&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;IdentityProvider = identityProvider,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;};&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.AddRelatedObject(identityProvider, &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;IdentityProviderAddresses&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;, googleRealm);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.SaveChanges(&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;SaveChangesOptions&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;"&gt;.Batch);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font style="font-size:11pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;We now need to associate our new Google IdentityProvider with the relying party applications that will depend upon it. In our case, this is every RelyingParty defined (other than the AcessControlManagement) so we simply loop through them as the following code demonstrates:&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;// Make this IDP available to relaying parties&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;// (except for the Management RP)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;foreach&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#000000"&gt; (&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;RelyingParty&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#000000"&gt; rp &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;in&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; ms.RelyingParties) {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;// Skip the built-in management RP&lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#000000"&gt; (rp.Name != &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;AccessControlManagement&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;) {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:3;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.AddToRelyingPartyIdentityProviders(&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;RelyingPartyIdentityProvider&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt; {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:4;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;IdentityProviderId = identityProvider.Id,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:4;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;RelyingPartyId = rp.Id&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:3;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;});&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:2;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;span style="mso-tab-count:1;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ms.SaveChanges(&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SaveChangesOptions&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;.Batch);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font style="font-size:11pt;" color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 10pt;" class="MsoNormal"&gt;This should be enough to supplement your knowledge of using the Windows Azure AppFabric Labs v2.0 Access Control Service Management API to programmatically setup Google (or Yahoo) as an Identity Provider for your relying party applications.&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=19685" width="1" height="1"&gt;</description></item><item><title>Scaling Up Or Scaling Out In The Cloud</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/12/19/scaling-up-or-scaling-out-in-the-cloud.aspx</link><pubDate>Sun, 19 Dec 2010 05:53:05 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:19196</guid><dc:creator>pmehner</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/19196.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=19196</wfw:commentRss><description>&lt;p&gt;Windows Azure provides us the ability to scale our application up by specifying how many CPU cores we want in our service instances, or to scale out by specifying how many single-core instances we require. Both strategies can be used to accomplish our scaling objectives for the same price (8 1-Core machines @ 12 cents/hour or 1 8-core machine @ 96 cents/hour), but in smaller deployment scenarios (under 8 CPU cores) there are a couple of advantages that clearly favor selecting a greater number of small-VM instances over a single VM instance with an equivalent number of cores.&lt;/p&gt;  &lt;p&gt;The Windows Azure Service Level Agreement (SLA) guarantees 99.95% service uptime. To receive this benefit, the SLA requires that you deploy a minimum of two service instances. Another important feature is the Rolling Upgrade. A rolling upgrade is a deployment feature of Windows Azure that allows service instances to be stopped and upgraded individually without bringing all of your instances down at the same time. This allows your service to remain operational during upgrade periods (albeit in a degraded state).&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=19196" width="1" height="1"&gt;</description></item><item><title>Installing Windows Azure SDK v1.3 Breaks Support for Visual Studio 2008</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/12/18/installing-windows-azure-sdk-v1-3-breaks-support-for-visual-studio-2008.aspx</link><pubDate>Sun, 19 Dec 2010 03:54:19 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:19194</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/19194.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=19194</wfw:commentRss><description>&lt;p&gt;Be aware that installing the November 2010 Windows Azure SDK v1.3 will break support for cloud projects running under Visual Studio 2008. To the best of my knowledge this was not widely announced (in fact, I learned about this fact during installation of the SDK). If you have Visual Studio 2008 Windows Azure projects, you’ll want to ensure that you have Visual Studio 2010 and a plan for migrating your projects prior to installing this new SDK. &lt;/p&gt;  &lt;p&gt;When running the SDK setup on a machine with Visual Studio 2008 installed, you’ll receive a warning that “&lt;em&gt;Setup has detected that Windows Azure Tools for Visual Studio 2008 is installed. As Windows Azure Tools 1.3 does not support Visual Studio 2008, if you continue to install this software, Windows Azure Tools for Visual Studio 2008 will stop working due to incompatible Windows Azure SDK version. Do you want to continue?&lt;/em&gt;”     &lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=19194" width="1" height="1"&gt;</description></item><item><title>Using The AsyncEnumerator To Improve Throughput of I/O-Bound Windows Azure Worker Roles</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/12/15/using-the-asyncenumerator-to-improve-throughput-of-i-o-bound-windows-azure-worker-roles.aspx</link><pubDate>Wed, 15 Dec 2010 19:24:53 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:19188</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/19188.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=19188</wfw:commentRss><description>&lt;p&gt;The Windows Azure Worker Role is a perfect place to put code that you want to run continuously in the background to process work as it becomes available. The information presented here would also be useful in web roles as well.&lt;/p&gt;  &lt;p&gt;If you’re writing cloud applications, its likely you are targeting high levels of performance and scalability. It is reasonable to expect that you want to get the most out of your investment in cloud computing, and making the best use of your purchased resources will save you money. It is therefore also reasonable to expect that most non-trivial applications that you deploy to a production cloud environment would be written to perform I/O operations asynchronously. &lt;/p&gt;  &lt;p&gt;In a Windows Azure Worker Role, a single thread is dispatched to your worker process’ Run method by the Windows Azure AppFabric. The rest of the threading model is left up to you. This is very much like a windows service or a console application. If you want to make maximum use of the cores available in your service instances then it is highly recommended that you leverage the CLR thread pool.&lt;/p&gt;  &lt;p&gt;Using the .NET Task Parallel Library (TPL) is an option if your worker roles are compute-bound, but it won’t help you much for I/O bound operations. Because today’s CPU’s are so powerful and the data being operated on by your worker role will generally have to be retrieved from some remote location such as Windows Azure Data Storage or SQL Azure, it is much more likely that your worker roles will be I/O-bound than compute-bound. If you use the TPL to increase concurrency it will do so by increasing the number of threads. Threads are resource heavy and there is a limit to the number that you can create before performance is degraded instead of being improved.&lt;/p&gt;  &lt;p&gt;The entry point for a Windows Azure Worker Role is the Run() method. Although we would really love it if the architecture of the Worker Role allowed us to not block this thread until we want to terminate the worker role, the Windows Azure Worker Roles do not allow this… so we reluctantly put ourselves into an infinite “while(true)” loop with a 3 second sleep interval, and when there is work to perform in the job queues this thread dispatches the messages to the thread pool during its next wake cycle. The thread pool typically creates one thread per CPU, and these threads will process the messages concurrently and efficiently (without context switching).&lt;/p&gt;  &lt;p&gt;As depicted in the following code example, we get the maximum number of messages that we can from the Windows Azure Data Storage queue, and then we create an AsyncEnumerator instance to asynchronously process each message. We call the BeginExecute method of the AsyncEnumerator passing in the message processing routine “ProcessMsg”&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;font style="font-size:10pt;"&gt;public override void Run() {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;while (true) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;"&gt;&lt;font color="#2b91af"&gt;Boolean&lt;/font&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt; anyMsgs = false;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// I call GetMessages synchronously because the Run thread can't do anything else&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;foreach (var msg in s_msgQueue.GetMessages(&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;"&gt;&lt;font color="#2b91af"&gt;CloudQueueMessage&lt;/font&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt;.MaxNumberOfMessagesToPeek, &lt;/font&gt;&lt;span style="line-height:normal;"&gt;&lt;font color="#2b91af"&gt;TimeSpan&lt;/font&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt;.FromSeconds(30))) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;anyMsgs = true;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var ae = new &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;"&gt;&lt;font color="#2b91af"&gt;AsyncEnumerator&lt;/font&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt;();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;ae.BeginExecute(ProcessMsg(ae, msg), ae.EndExecute, null);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // there may still be messages in the queue so don’t sleep; try to get them&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;if (anyMsgs == false) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// I call Thread.Sleep synchronously because the Run thread can't do anything else&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;"&gt;&lt;font color="#2b91af"&gt;Thread&lt;/font&gt;&lt;/span&gt;&lt;font color="#0000ff"&gt;.Sleep(3000);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The ProcessMsg routine (as shown below) handles the grunge work of processing each of the incoming messages in an asynchronous fashion. In this example, each message represents an image to be watermarked, but this code is meant to be generic and representative of any operation that included some I/O aspects to it. Notice that all I/O operations in the ProcessMsg routine utilize the Begin and End methods as described in the Asynchronous Programming Model (APM).&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&amp;#160; &lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;private IEnumerator&amp;lt;Int32&amp;gt; ProcessMsg(AsyncEnumerator ae, CloudQueueMessage cloudMsg) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;QueueMessage msg = QueueMessage.Parse(cloudMsg.AsString);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var ctx = s_tables.GetDataServiceContext();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var query = (DataServiceQuery&amp;lt;MyEntity&amp;gt;)(from e in ctx.CreateQuery&amp;lt;MyEntity&amp;gt;(c_containerName)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;where (msg.PartitionKey == e.PartitionKey) &amp;amp;&amp;amp; (msg.RowKey == e.RowKey)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;select e);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;query.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;Begin&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;Execute(ae.End(), null);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;yield return 1;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var p = query.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;Execute(ae.DequeueAsyncResult()).FirstOrDefault();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;if (p == null) yield break;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// Entity deleted, skip this one&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font style="background-color:#ffffff;" color="#444444" size="2" face="Segoe UI"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// Grab image from blob (could throw), thumbnail it, create new thumbnail blob&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var container = s_blobs.GetContainerReference(c_containerName);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;var blob = container.GetBlockBlobReference(p.PhotoBlobID);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// Get our blob’s attributes&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;blob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;Begin&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;FetchAttributes(ae.End(), null);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;yield return 1;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;blob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;FetchAttributes(ae.DequeueAsyncResult());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:normal;"&gt;&lt;font style="font-size:10pt;" color="#008000"&gt;// How do we get the length of a blob&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;MemoryStream ms = new MemoryStream(checked((Int32)blob.Properties.Length));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;blob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;Begin&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;DownloadToStream(ms, ae.End(), null);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;yield return 1;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;blob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;DownloadToStream(ae.DequeueAsyncResult());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;" color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;String newBlobID = Guid.NewGuid().ToString();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;CloudBlockBlob newblob = blob.Container.GetBlockBlobReference(newBlobID);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;newblob.Properties.ContentType = blob.Properties.ContentType;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;newblob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;Begin&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;UploadFromStream(CreateWatermarked(ms), ae.End(), null);           &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;yield return 1;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;blob.&lt;font style="background-color:#ffff00;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;EndU&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;ploadFromStream(ae.DequeueAsyncResult());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:10pt;"&gt;       &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;span style="line-height:normal;mso-spacerun:yes;"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;        &lt;p style="line-height:normal;background-color:#dbe5f1;margin:0in 0in 0pt 0.5in;" class="Code"&gt;&lt;/p&gt;     &lt;/font&gt;&lt;/font&gt;&amp;#160;&lt;/font&gt;   &lt;p&gt;For more information on the AsyncEnumerator, you will want to read Jeffrey Richter’s June 2008 Concurrent Affairs article (see &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc546608.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc546608.aspx&lt;/a&gt;). The AsyncEnumerator is part of the Wintellect Power Threading Library which you may download from here: &lt;a href="http://wintellect.com/powerthreading.aspx"&gt;http://wintellect.com/powerthreading.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=19188" width="1" height="1"&gt;</description></item><item><title>Updated FAQ for SQL Azure</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/05/10/updated-faq-for-sql-azure.aspx</link><pubDate>Mon, 10 May 2010 18:25:29 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:14031</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/14031.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=14031</wfw:commentRss><description>&lt;p&gt;Microsoft published an updated FAQ (May 3, 2010) for SQL Azure, available &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ffc9536c-c548-453a-92b8-c6614c63a26e&amp;amp;displayLang=en" target="_blank"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The FAQ is very thorough and is a “must read” for any organization planning a relational database migration or new cloud application&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“This paper provides an architectural overview of SQL Azure Database, and describes how you can use SQL Azure to augment your existing on-premises data infrastructure or as your complete database solution”&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=14031" width="1" height="1"&gt;</description></item><item><title>Improving Windows Azure Storage Throughput Using the Content Delivery Network</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/05/04/improving-windows-azure-storage-throughput-using-the-content-delivery-network.aspx</link><pubDate>Wed, 05 May 2010 02:46:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:13885</guid><dc:creator>pmehner</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/13885.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=13885</wfw:commentRss><description>&lt;p&gt;Windows Azure Content Delivery Network (CDN) caches your Windows Azure Data Storage blobs at strategically placed locations around the world (18 at the time of this blog post). The purpose of the CDN is to provide maximum bandwidth for delivery of content to our applications and users. Building massively scalable applications requires squeezing every ounce of juice possible from the infrastructure and machinery. The CDN significantly improves retrieval performance for our most frequently used anonymously accessible read-only data.&lt;/p&gt;  &lt;p&gt;The CDN works by caching the first request made to retrieve a blob from Windows Azure Data Storage using a specialized URL that maps to our data storage account. It then keeps the results of that query in that geographically localized cache so that subsequent requests to the same blob can be performed from the cache, which is much faster than the original trip to fetch the blob from the more geographically distant data center. Any blob requested through a special CDN URL will be served from the local cache until its Time To Live (TTL) has expired, in which case a fresh copy of the blob will be retrieved from data center blob storage with a fresh TTL. As the first request still requires retrieval from data center storage, frequently used blobs will receive the greatest performance boost. There is no performance advantage to serving infrequently used blobs through the CDN. Because the emphasized purpose of the CDN is to improve throughput, it is only available for anonymous access of public blob containers, thereby eliminating the overhead of authentication and authorization. At the time of this blog post, the CDN was still a Community Technology Preview feature. You can turn it on in the Data Storage configuration page of the Windows Azure Developer Portal.&lt;/p&gt;  &lt;p&gt;To learn more about the CDN, please start with this article on the Windows Azure Team Blog located &lt;a href="http://blogs.msdn.com/windowsazure/archive/2009/11/05/introducing-the-windows-azure-content-delivery-network.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=13885" width="1" height="1"&gt;</description></item><item><title>Learning Windows Azure platform Resources</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/04/20/learning-windows-azure-platform-resources.aspx</link><pubDate>Tue, 20 Apr 2010 06:11:38 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:13455</guid><dc:creator>pmehner</dc:creator><slash:comments>2</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/13455.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=13455</wfw:commentRss><description>&lt;p&gt;I’ve assembled a short list of training materials and utilities that are helpful in learning the Windows Azure platform&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows Azure SDK v1.1 samples      &lt;ul&gt;       &lt;li&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyID=dba6a576-468d-4ef6-877e-b14e3c865d3a&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=dba6a576-468d-4ef6-877e-b14e3c865d3a&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=dba6a576-468d-4ef6-877e-b14e3c865d3a&amp;amp;displaylang=en&lt;/a&gt; &lt;/li&gt;        &lt;li&gt;Windows Azure Samples: C:\Program Files\Windows Azure SDK\v1.1\Samples.zip &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Windows Azure platform AppFabric v1.0 Code Samples      &lt;ul&gt;       &lt;li&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?familyid=39856A03-1490-4283-908F-C8BF0BFAD8A5&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?familyid=39856A03-1490-4283-908F-C8BF0BFAD8A5&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=39856A03-1490-4283-908F-C8BF0BFAD8A5&amp;amp;displaylang=en&lt;/a&gt; &lt;/li&gt;        &lt;li&gt;C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Samples &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Windows Azure Platform Training Kit      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&amp;amp;displaylang=en"&gt;http://&lt;/a&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&amp;amp;displaylang=en"&gt;www.microsoft.com/downloads/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&amp;amp;displaylang=en&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Windows Azure Management CmdLets      &lt;ul&gt;       &lt;li&gt;This set of PowerShell CmdLets allow you to write PowerShell&amp;#160; scripts to automate your Windows Azure deployments and maintenance. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/azurecmdlets"&gt;http&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/azurecmdlets"&gt;://&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/azurecmdlets"&gt;code.msdn.microsoft.com/azurecmdlets&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Windows Azure Storage Explorer (Neudesic)      &lt;ul&gt;       &lt;li&gt;This tool allows you to explore Windows Azure Data Storage &lt;/li&gt;        &lt;li&gt;&lt;a href="http://azurestorageexplorer.codeplex.com/"&gt;http&lt;/a&gt;&lt;a href="http://azurestorageexplorer.codeplex.com/"&gt;://azurestorageexplorer.codeplex.com&lt;/a&gt;&lt;a href="http://azurestorageexplorer.codeplex.com/"&gt;/&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Windows Azure Service Management Tools      &lt;ul&gt;       &lt;li&gt;This tool allows you to explore Windows Azure Data Storage &lt;/li&gt;        &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/AzureManagementTools"&gt;http://&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/AzureManagementTools"&gt;code.msdn.microsoft.com/AzureManagementTools&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;SQL Azure Migration Wizard      &lt;ul&gt;       &lt;li&gt;This tool allow you to analyze an existing database or script for promotion into the Cloud &lt;/li&gt;        &lt;li&gt;&lt;a href="http://sqlazuremw.codeplex.com/"&gt;http&lt;/a&gt;&lt;a href="http://sqlazuremw.codeplex.com/"&gt;://sqlazuremw.codeplex.com&lt;/a&gt;&lt;a href="http://sqlazuremw.codeplex.com/"&gt;/&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=13455" width="1" height="1"&gt;</description></item><item><title>Understanding Windows Azure platform AppFabric Access Control Service Resources</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/04/06/understanding-windows-azure-platform-appfabric-access-control-service-resources.aspx</link><pubDate>Tue, 06 Apr 2010 18:11:38 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:13114</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/13114.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=13114</wfw:commentRss><description>&lt;p&gt;Before we can begin using the Windows Azure AppFabric Access Control Service (ACS) to decouple our applications from security concerns and enable claims-based identities we need to understand the Resources contained in the Service Namespace and what role they play in the authentication and authorization infrastructure. This brief blog entry is meant to provide you with the basic understanding and vocabulary required to get started.&lt;/p&gt;  &lt;p&gt;&lt;a name="_Toc258268923"&gt;Service Namespace&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The Service Namespace is an abstraction for the collection of ACS Resources including Token Policies, Scopes, Issuers, and Rules (which are described in more detail below). &lt;/p&gt;  &lt;p&gt;The Service Namespace is comprised of a hierarchy of related entities. At the root of this hierarchy is the AppFabric Service Account Project. The Service Namespace can be broken into three constituent parts as shown in Figure 1, the Token Policy, the Scope, and the Issuer. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_5F267E62.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://www.wintellect.com/CS/blogs/pmehner/image_thumb_3DC6D8C6.png" width="641" height="315" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;a name="_Ref258244291"&gt;Figure &lt;/a&gt;1 - Service Namespace Object Hierarchy&lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268923"&gt;Token Policy&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;A Token Policy defines token expiration periods and digital signing keys. A Token Policy may be shared across Service Namespaces and is used by the ACS to sign the response tokens and to set their expiration periods. &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268924"&gt;Issuer&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;An issuer is a party that will issue requests for tokens from the ACS. An Issuer may not be shared across Service Namespaces. &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268925"&gt;Scope&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;A Scope groups rules governing ACS token issuing behavior. A Scope contains exactly one internal RuleSet object which can be populated with multiple Rules. A Scope may not be shared across Service Namespaces. &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268926"&gt;Rule&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;A Rule defines a transformation between one or more input claims and one or more output claims. Rules cannot be shared across Service Namespaces. The Rule feature is one of the most powerful and innovative features of the Windows Azure ACS.&amp;#160; &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268927"&gt;RuleSet&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;A RuleSet is a collection of individual Rule objects. We do not directly create the RuleSet object; one is created automatically for us as part of a Scope. &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268928"&gt;Claim&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;The ACS Rules engine uses Rule objects to perform actions using incoming claims to create outgoing claims. A Claim is a statement that can be made about an entity. Applications and Services such as the ones that you will build specify what claims are necessary to perform a given operation. &lt;/p&gt;  &lt;h5&gt;&lt;a name="_Toc258268929"&gt;Identity&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;Simply stated, an Identity is a collection of claims. Your ACS enabled application will accept identities from the ACS, an identity provider that your application implicitly trusts. The ACS will verify the claims made by your application users, and will transform those claims into ones usable by your application using the Rules defined in the Ruleset of the Scope that applies to your Service Namespace. &lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=13114" width="1" height="1"&gt;</description></item><item><title>Managing Windows Azure Deployments with Windows Azure Service Management CmdLets</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/03/26/managing-windows-azure-deployments-with-windows-azure-service-management-cmdlets.aspx</link><pubDate>Fri, 26 Mar 2010 21:31:36 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:12843</guid><dc:creator>pmehner</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/12843.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=12843</wfw:commentRss><description>&lt;p&gt;Before you begin your Windows Azure development experience in earnest, you should be aware that leaving development and test instances deployed and running in the cloud can be expensive. Be aware that y&lt;em&gt;ou will be billed for deployed service instances, even if they are suspended,&lt;/em&gt; so it is important that you actually remove the instances when you are done using them. Microsoft has many options available for providing developers with their own “little patch” of the cloud fabric quilt; however, it is easy to exceed these limits if you are not careful or simply forget to remove them.&lt;/p&gt;  &lt;p&gt;To give you some idea, my Windows Azure bill has been running over $500 per month for four hosted services and four storage services (plus a few extra instances in staging environments). This is for mostly idle instances (used for demo and training purposes). There are many variables in pricing outside the scope of this short blog post, so your costs could be much different. My purpose in drawing your attention to it here is to give you some financial sense as to why I view the information in this blog post important.&lt;/p&gt;  &lt;p&gt;When developing Windows Azure cloud applications, you will want to make heavy use of the DevFabric and DevStorage. You should only deploy to the cloud when necessary to test your application in a way that cannot be easily done on your desktop. For example,&amp;#160; it is impossible to gain much knowledge about the scalability of the Windows Azure Platform from an application running solely on the desktop, or even to observe many of the features of the cloud fabric such as a simulated instance failure. &lt;/p&gt;  &lt;p&gt;The Windows Azure Developer Portal allows us to install and remove application deployments. The portal is very straight forward and easy to operate, but the process requires operator interactivity. A deployment can take 30 minutes to get running once it has been uploaded and deployed, so there can also be the problem of a developer having to wait and monitor the deployments before taking subsequent steps. As developers, we want to automate steps of our deployment that are easily identified and highly repeatable. Good news! Windows Azure may be managed through the developer portal, but its RESTful API has been exposed for automation purposes. You can read more about the Windows Azure Service Management REST API &lt;a href="http://msdn.microsoft.com/en-us/library/ee460799.aspx"&gt;here&lt;/a&gt; on the MSDN website. &lt;/p&gt;  &lt;p&gt;Microsoft has built a set of PowerShell CmdLets, which leverage this RESTful API thus allowing us to script our deployments and service removals, making them rapid and repeatable. You can get the PowerShell CmdLets off of the MSDN site &lt;a href="http://code.msdn.microsoft.com/azurecmdlets"&gt;here&lt;/a&gt; and there is a great “getting started” blog post on the MSDN site &lt;a&gt;here&lt;/a&gt;. Using the Windows Azure CmdLets I have been able to automate my deployments and service removals, potentially saving myself hundreds of dollars per month in unnecessary charges (I’ll let you know next month exactly how much I saved).&lt;/p&gt;  &lt;p&gt;My first experience with the Windows Azure Service Management CmdLets wasn’t entirely painless. I wasn’t able to get the “New-Deployment” CmdLet to operate properly out-of-the-box, and I ended up spending numerous hours trying to diagnose why.&amp;#160; The traffic is encrypted over https and the Windows Azure error messages can often be deliberately vague for security reasons. Fiddler wasn’t of much use either, as Azure detected it’s man-in-the-middle certificate and refused to let me monitor the unencrypted https wire traffic. Failing to be able to watch the traffic, I attached a debugger to the Windows Azure Service Management CmdLet source code and monitored execution,. This allowed me to discover that the WCF Behavior interceptor which inspects outbound messages sent to the Windows Azure management endpoint and appends the required Version Number header to the request was unable to find the httpRequest property in the outbound message. The code assumed that this property &lt;em&gt;would always be present&lt;/em&gt; (it didn’t check first) so an unhandled exception was being thrown causing the deployment to fail. I did not get to the bottom of why the header was missing (I’m hoping to find this out at a later time), but I revised the ClientOutputMessageInspector interceptor code to try to get the property first, and then add it if it did not exist. This seemed to fix the problem as I am now able to successfully deploy. My code revision follows. You can find the BeforeSendRequest method in the ServiceManagementHelper.cs, file, near line 206:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_4280A514.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://www.wintellect.com/CS/blogs/pmehner/image_thumb_39B09CC8.png" width="725" height="254" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’m interested in others have run into the same issue, or if it was local somehow to my experience. Please drop me a note and let me know.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://dunnry.com/blog/" href="http://dunnry.com/blog/"&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=12843" width="1" height="1"&gt;</description></item><item><title>How To Get Diagnostic Data From Services Running In The Windows Azure Cloud</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/03/10/how-to-get-diagnostic-data-from-services-running-in-the-windows-azure-cloud.aspx</link><pubDate>Wed, 10 Mar 2010 19:48:19 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:12496</guid><dc:creator>pmehner</dc:creator><slash:comments>2</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/12496.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=12496</wfw:commentRss><description>&lt;p&gt;&lt;font size="3"&gt;Each instance of Windows Azure Service Role runs its own monitor to gather its own instance specific diagnostic data. The problem that immediately presents itself is knowing what exactly is being collected, where the data is being saved, and how to retrieve it for inspection. The purpose of this blog post is to illuminate these areas a little bit better.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;So lets start at the beginning… When you create a new Windows Azure Web Role, Visual Studio will automatically add a boilerplate WebRole.cs file to your project. By default, the OnStart() method of the WebRole is overridden with an implementation that starts the Windows Azure Diagnostic Monitor. By default, Windows Azure will log its own diagnostics, IIS 7.0 logs, plus Windows Diagnostics. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&amp;#160;&lt;/font&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_273B6C34.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_4CC4E995.png" width="579" height="140" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;The argument to the static Start method of the DiagnosticMonitor class is the Windows Azure Data Storage connection string located in the ServiceConfiguration.cscfg file.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_5D5CE483.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_69EA919F.png" width="593" height="115" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;When the value of the connection string is “UseDevelopmentStorage=true” then the Developer Fabric will use the local Development Storage to simulate storage in the cloud. Of course in staging or production, this string would point to the RESTful data storage endpoint and would contain your Windows Azure Data Storage AccountName and AccountKey.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;We can inspect the “wad-control-container” of Blob storage to find the collected diagnostic information. run your favorite Windows Azure Storage exploration tool. In my example, I am using the &lt;/font&gt;&lt;a href="http://azurestorageexplorer.codeplex.com/"&gt;&lt;font size="3"&gt;Windows Azure Storage Explorer from the CodePlex&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; site. You can use this tool to download the container and its contents to your local file-system for further analysis.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&amp;#160;&lt;/font&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_07E89F94.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_0969BBA8.png" width="590" height="555" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;We can also augment the diagnostic data collected to include other data sources as well.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Let’s say you’re also interested in capturing failed IIS and ASP.NET requests. You can augment the data that Windows Azure is already capturing by adding a &amp;lt;traceFailedRequest&amp;gt; element to the &amp;lt;system.webServer/tracing&amp;gt; section. Of course you can control the paths of the page(s) to be tracked, and you can set the verbosity to an appropriate tracing level for your circumstance, including filtering the general areas of coverage such as Authentication, Security, etc. An example might look like this:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&amp;#160;&lt;/font&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_430C5592.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_059BF10B.png" width="597" height="266" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;We can also collect Windows Event Logs by simply adding an XPath expression of the event sources to be captured of the WindowsEventLog.DataSources property located on the configuration object.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_5912C124.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_50AEEBCD.png" width="604" height="209" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt; `&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;It is possible that a hardware or software defect might be causing mysterious or intermittent operating system failures. Fortunately, we can also configure our instances to collect full or partial crash dumps by calling the static EnableCollection method of the Microsoft.WindowsAzure.Diagnostics.CrashDumps type. Passing true to this method will capture complete crash dumps, passing false will collect partial dumps.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.wintellect.com/CS/blogs/pmehner/image_5D3C98E9.png"&gt;&lt;font size="3"&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://www.wintellect.com/CS/blogs/pmehner/image_thumb_0DEFA095.png" width="603" height="186" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Although the path may be slightly more illuminated now, there are still many dark areas beyond our present location. In my opinion, there is still much work to be done&amp;#160; in tooling and making this data useable in “real world” scenarios. It is trivial to sift through a dozen or so entries from a single service instance, but it is nearly impossible to imagine the difficulty of finding what you are looking for in the potentially massive data collected by multiple simultaneous service instances running a busy high-volume application. There are several parties working to provide solutions in this space, but no clear leaders at this time.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=12496" width="1" height="1"&gt;</description></item><item><title>Idempotency for Windows Azure Message Queues</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/02/28/idempotency-for-windows-azure-message-queues.aspx</link><pubDate>Mon, 01 Mar 2010 03:58:41 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:12239</guid><dc:creator>pmehner</dc:creator><slash:comments>3</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/12239.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=12239</wfw:commentRss><description>&lt;p&gt;&lt;font size="4"&gt;Idempotency is the mathematical term used to describe a system that produces the same result when a formula or procedure is applied numerous times against the same target. In software systems, this translates to an ability to perform an operation more than one time with knowledge that the resulting state of the system will be consistent. Idempotency does not dictate the mechanism by which this consistency is to be achieved, only the fact that it must.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Queues are useful in Windows Azure for delivering work requests to worker roles. It is the primary architectural means by which web roles signal worker roles to begin asynchronous performance of work. &lt;/font&gt;&lt;font size="4"&gt;When a worker role accepts a message from a queue, the queue hides that message from other workers for 30 seconds to reduce the probability that a message will be operated on by multiple simultaneous workers. This approach does much to greatly reduce the &lt;em&gt;probability&lt;/em&gt; that redundant work will be performed by the system, but it does not prevent it!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;If a message takes longer to process than is allowed by Windows Azure, then the message is made visible again for other workers to pick up and process. It is therefore possible for more than one worker to be working on the same work at the same time… the original recipient of the message, plus the new worker who picks it up when it becomes visible in the queue again. In addition, the &lt;/font&gt;&lt;font size="4"&gt;typical pattern for failed or corrupted message receipt in a fault tolerant system is to retry message delivery. This can also lead to redundant work being performed. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;The fact that multiple workers may work on the same message makes it essential for us to design our software for use in the cloud with idempotence in mind. An argument that idempotence will only matter once in hundreds of thousands of transactions is still very problematic if your system may be processing millions of transactions, or where the integrity of your data may be mission critical.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;There seems to be a lot of blog posts and forum entries on the importance of writing idempotent services, but very little in the way of constructive feedback that I was able to find on how developers should go about achieving the objective of idempotency, and thus the purpose of this blog post.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;One suggested technique for achieving idempotency that I read on several blogs and saw being discussed in forums while grokking material on this topic was to avoid the problem altogether. Many people suggested creating a table of message IDs and then forcing the workers verify the state of a message by consulting the table before processing an incoming message. Even one book author of SOA architectures put this idea forward. To my way of thinking, avoidance of idempotency does not make your software idempotent; such schemes are merely a pattern to avoid the problem rather than to design for it. This isn’t necessarily a bad way to go for some software systems, but be aware that pattern itself may contain its own set of flaws because an error could keep the table from being updated, and t&lt;/font&gt;&lt;font size="4"&gt;here is a time windows where the database table itself might hold inaccurate state information thereby allowing the two workers to still execute simultaneously. The old two-phase commit solution starts to raise its ugly head. Since such schemes could have problems, a better question to ask yourself is this… &lt;/font&gt;&lt;font size="4"&gt;what is the sate of your data will be after the execution of a message received multiple times. Is your data consistent or inconsistent?&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;For a system to be truly idempotent we must be capable of processing the same message twice and after processing that message we must still be in a consistent state.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Let’s say that we want to update a customer’s address. Our service receives a message from some application with the new street address of our customer. We process the message and the address is changed in our database. If we receive this message again the work will be performed twice. No matter how inefficient or unsavory this may be, the resulting state of the customer’s address will be identical. In other words, our overly-simplified address change operation would be considered idempotent. &lt;/font&gt;&lt;font size="4"&gt;If two messages for the same customer arrive carrying two separate addresses, the first one would succeed and so would the second one. Again, we would still be idempotent in the sense that our data was consistent; however, we have set ourselves up for a “last-in-wins” model. This is not necessarily a bad thing but we should be aware of it in our design.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Many businesses extend credit to their customers. No reasonable business would extend such credit without placing limits on it. Instead of the customer address example, let imagine that our messages are for new orders from our customers. If such a message were to be processed twice without any concern for idempotency, our customer might receive twice as much product as they ordered, and they may find themselves prematurely exceeding their credit limit on subsequent orders. This would clearly not be idempotent. So how do we get to where we want to go? &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;If the message contains the invoice number, then we might construct our business and database operations to perform the add operation in such a manner as to ensure that the data is never inserted into the table twice. We could perform the insertion into the invoice table as part of a transaction where the invoice number was not already present in the table. This would result in the insertion of one row into the table for the first receipt, but zero rows into the table on subsequent attempts. In other words our add operation would leave the data in a consistent state no matter how many times we replayed the message.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;If the message was to perform an update of an existing invoice, then things get a little more sophisticated, but still very manageable. By using and comparing a timestamp column for equality with the value contained in the message we can perform the update where the row’s timestamp column is equal to the value contained in the message. If the incoming message caries an equivalent timestamp of the data at the time that it was issued to the sender, then this timestamp can be checked against the one in the database as parameter to the WHERE clause&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;UPDATE Invoice Set &lt;a href="mailto:Amount=@Amount"&gt;Amount=@Amount&lt;/a&gt; WHERE InvoiceNumber=12345 and tstamp = @tstamp&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;If the data has not been updated by another worker since it was issued, then the update operation will modify the matching invoice number row, but&amp;#160; if the message is duplicate, then the tstamp column will have a new value which will result in zero rows being updated (as no rows will satisfy the timestamp equality constraint). We can now process an infinite number of updates while remaining idempotent. Of course this technique would be a better approach for the simpler address change example that I provided above.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Clearly there is much more that can be said in this space, but that is all I have time for in this blog post. Look for additional advice and commentary in future posts.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;&amp;#160;&lt;/font&gt;&lt;font size="4"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=12239" width="1" height="1"&gt;</description></item><item><title>Windows Communication Foundation Data Services (Astoria) – The Stuff They Should Have Told You Before You Started</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2010/02/10/windows-communication-foundation-data-services-astoria-the-stuff-they-should-have-told-you-before-you-started.aspx</link><pubDate>Wed, 10 Feb 2010 21:13:05 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:12089</guid><dc:creator>pmehner</dc:creator><slash:comments>1</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/12089.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=12089</wfw:commentRss><description>&lt;p&gt;&lt;font size="4"&gt;Entity Framework derived types support inheritance and relationships, just as you’d expect from any Object Relational Mapper tool (ORM)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Windows Communication Foundation Data Services (Astoria) throws an exception if your derived entities have relationships. That means if a Contact, a Lead, and a Doctor all inherit from a Person… and derived entities have different needs to link to external data… too bad!… Suddenly we have Sales Leads having properties for writing medical prescriptions! Good grief! That’s not going to be pretty… so ugly in fact… we probably don’t even want to go there…. The official prescription for this from the MS forums and various blogs is to move those relationships into the base Person class and then refactor your database storage as necessary…. perhaps having separate and distinct tables for Doctor, Lead, and Contact. Wait-a-sec you say… you picked an ORM because you didn’t want your Object Model to be dictated by your Data Model… well… that’s true… but here you find yourself anyway…&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;This bit me in the butt big-time on a project I was working on. There was nothing in the documentation and or the services behavior to lead me to believe that this constraint would be present… (well… okay… other than the initials CTP &amp;lt;/grin&amp;gt; but still…) Knowledge of the constraint happens way too far along on the development cycle. We did not realize the presence of this constraint until after my team had invested heavily in development of our ORM and database models. These models worked well so long as we were only unit testing them. It wasn’t until we tried to expose them through Astoria that the big bomb dropped in the room. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Having the service tier force a rigid database implementation upon a team is the tail wagging the dog. Also... developer teams often do not have control over what a DBA may require in the database, and WCF Data Services should not be so brittle and constrictive as to disallow common use-case scenarios like practical and real-world use of inheritance. There is nothing complex about this business use-case… in fact I would say it is quite representative of the norm.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;My friend Julie Lerman (author of &lt;/font&gt;&lt;a href="http://oreilly.com/catalog/9780596520298"&gt;&lt;font size="4"&gt;Programming Entity Framework&lt;/font&gt;&lt;/a&gt;&lt;font size="4"&gt; on O’Reilly Press) created a suggestion for this basic “feature” on the Microsoft Connect site. If you agree with its importance… please take a second to click the link and vote on it:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://connect.microsoft.com/data/feedback/details/532592/derived-entites-should-be-allowed-to-have-relationships-in-wcf-data-services"&gt;&lt;font size="4"&gt;https://connect.microsoft.com/data/feedback/details/532592/derived-entites-should-be-allowed-to-have-relationships-in-wcf-data-services&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;Another item to be aware of regarding inheritance with Entity Framework: two derived types cannot share the same primary key. That means that the a Sales Lead cannot also be a Contact… thus forcing duplication of the Person and all the data related to that person (duplicate addresses, duplicate phone numbers, duplicate emails, etc.). There are no warnings in the designer of this snake in the grass… you’ll know the first time you attempt to retrieve data in the database where these conditions occur (a Person existing in more than one of the derived database tables). You can save the data this way… you can just never retrieve it after the fact! Again… this appears to be a very naïve constraint.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=12089" width="1" height="1"&gt;</description></item><item><title>Migrating Polling Duplex Binding Element from Silverlight v2.0 to v3.0 for WCF Services In The Cloud Code Samples</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2009/10/25/migrating-polling-duplex-binding-element-from-silverlight-v2-0-to-v3-0-for-wcf-services-in-the-cloud-code-samples.aspx</link><pubDate>Sun, 25 Oct 2009 04:08:00 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:9690</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/9690.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=9690</wfw:commentRss><description>&lt;P&gt;When running the WCF / Windows Azure samples (see my previous blog entry) you may get an error indicating that the Polling Duplex Binding Element cannot be loaded if you have Silverlight v3.0 installed (The type 'System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex' registered for extension 'pollingDuplex' could not be loaded). &lt;/P&gt;
&lt;P&gt;Replace the reference in the WcfSamples project from the v2.0 Silverlight Duplex Polling assembly C:\Program Files (x86)\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\System.ServiceModel.PollingDuplex.dll with the v3.0 version: C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Server\System.ServiceModel.PollingDuplex.dll &lt;/P&gt;
&lt;P&gt;Set the Copy Local property to true. &lt;/P&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=9690" width="1" height="1"&gt;</description></item><item><title>Code Samples for Hosting WCF Services In The Cloud</title><link>http://www.wintellect.com/CS/blogs/pmehner/archive/2009/10/22/code-samples-for-hosting-wcf-services-in-the-cloud.aspx</link><pubDate>Thu, 22 Oct 2009 22:51:26 GMT</pubDate><guid isPermaLink="false">c9b5046a-91b6-4822-a57a-d848b8cb6435:9409</guid><dc:creator>pmehner</dc:creator><slash:comments>0</slash:comments><comments>http://www.wintellect.com/CS/blogs/pmehner/comments/9409.aspx</comments><wfw:commentRss>http://www.wintellect.com/CS/blogs/pmehner/commentrss.aspx?PostID=9409</wfw:commentRss><description>&lt;p&gt;Code samples demonstrating how to host WCF Services under Windows Azure can be found on the MSDN site at:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/wcfazure" href="http://code.msdn.microsoft.com/wcfazure"&gt;http://code.msdn.microsoft.com/wcfazure&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.wintellect.com/CS/aggbug.aspx?PostID=9409" width="1" height="1"&gt;</description></item></channel></rss>
