<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Wade Wegner</title>
	
	<link>http://www.wadewegner.com</link>
	<description>From the whiteboard to the keyboard</description>
	<lastBuildDate>Wed, 25 Jan 2012 19:00:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WadeWegner" /><feedburner:info uri="wadewegner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>39.610431</geo:lat><geo:long>-104.881399</geo:long><feedburner:emailServiceId>WadeWegner</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/WadeWegner" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FWadeWegner" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><item>
		<title>Cannot create database ‘DevelopmentStorageDb20110816′ for the Windows Azure Storage Emulator</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/t9_ReS0w64g/</link>
		<comments>http://www.wadewegner.com/2012/01/cannot-create-database-developmentstoragedb20110816-in-storage-emulator-azure-sdk/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 18:37:14 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Storage Emulator]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Azure Storage]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/?p=1770</guid>
		<description><![CDATA[Have you seen this error before? If you’ve spent any time with the Windows Azure storage emulator it’s highly probable. Here’s the full text: Added reservation for http://127.0.0.1:10000/ in user account COMPUTER\User. Added reservation for http://127.0.0.1:10001/ in user account COMPUTER\User. Added reservation for http://127.0.0.1:10002/ in user account COMPUTER\User. Creating database DevelopmentStorageDb20110816... Cannot create database 'DevelopmentStorageDb20110816' [...]]]></description>
			<content:encoded><![CDATA[
<p>Have you seen this error before? If you’ve spent any time with the Windows Azure storage emulator it’s highly probable. Here’s the full text:</p>
<pre class="code">    Added reservation for http://127.0.0.1:10000/ in user account COMPUTER\User.
    Added reservation for http://127.0.0.1:10001/ in user account COMPUTER\User.
    Added reservation for http://127.0.0.1:10002/ in user account COMPUTER\User.

    Creating database DevelopmentStorageDb20110816...
    Cannot create database 'DevelopmentStorageDb20110816' : CREATE DATABASE permission
    denied in database 'master'.

    One or more initialization actions have failed. Resolve these errors before attempting
    to run the storage emulator again. These errors can occur if SQL Server was installed
    by someone other than the current user. Please refer to
    http://go.microsoft.com/fwlink/?LinkID=205140 for more details.</pre>
<p>And an image of the error:</p>
<p><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="Development Storage initialization error" border="0" alt="Development Storage initialization error" src="http://images.wadewegner.com/wordpress/2012/01/SQLError.png" width="484" height="370" /></p>
<p>This error can occur when running the storage emulator (or running DSINIT.exe) for the first time. The compute emulator needs to initialize itself, which includes creating a local SQL Server database that is used to store data for local Windows Azure storage. The above error indicates that there’s a permissions when trying to create the database.</p>
<p>There are a number of ways to resolve this issue and, like others, I have my favorite approach. I have a script that I run which will add the executing user to the SQL Server sysadmin role.</p>
<p>I&#8217;ve published the entire script here: <a target="_blank" href="https://gist.github.com/1677788">https://gist.github.com/1677788</a>. Simply download and unzip the file. Open up an elevated command prompt and execute the file (i.e. run <strong>addselftosqlsysadmin.cmd</strong>). Once the script is executed the user can successfully initialize the storage emulator.</p>
<p><script src="https://gist.github.com/1677788.js?file=addselftosqlsysadmin.cmd"></script></p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=t9_ReS0w64g:od6-RRt8WUE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=t9_ReS0w64g:od6-RRt8WUE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=t9_ReS0w64g:od6-RRt8WUE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=t9_ReS0w64g:od6-RRt8WUE:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/t9_ReS0w64g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2012/01/cannot-create-database-developmentstoragedb20110816-in-storage-emulator-azure-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2012/01/cannot-create-database-developmentstoragedb20110816-in-storage-emulator-azure-sdk/</feedburner:origLink></item>
		<item>
		<title>Are You Building Mobile + Cloud Applications? Tell Me!</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/zg1WYF0fxgg/</link>
		<comments>http://www.wadewegner.com/2012/01/are-you-building-mobile-cloud-applications-tell-me/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 19:02:43 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/?p=1764</guid>
		<description><![CDATA[If you follow my blog or on Twitter then you know that I’m passionate about using services running in Windows Azure to power mobile applications. To effectively run mobile services for mobile apps you need a platform that is responsive to a global audience and able to scale to the needs of your user base [...]]]></description>
			<content:encoded><![CDATA[
<p><img style="background-image: none; border-right-width: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WindowsAzure" border="0" alt="WindowsAzure" align="left" src="http://images.wadewegner.com/wordpress/2012/01/image8.png" width="88" height="154" />If you follow my blog or <a target="_blank" href="http://twitter.com/wadewegner" target="_blank">on Twitter</a> then you know that I’m passionate about using services running in Windows Azure to power mobile applications. To effectively run mobile services for mobile apps you need a platform that is responsive to a global audience and able to scale to the needs of your user base – Windows Azure provides these capabilities.</p>
<p>As part of the refresh of the <a target="_blank" href="http://www.windowsazure.com/" target="_blank">WindowsAzure.com</a> we have also provided additional information about <a target="_blank" href="http://www.windowsazure.com/en-us/home/scenarios/mobile/" target="_blank">mobile scenarios</a> – it’s worth taking a look.</p>
<p>We’ve built a lot of resources that you should take a look at, including: the <a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=234566&amp;clcid=0x409" target="_blank">Windows Azure Toolkit for iOS</a>, the <a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=234567&amp;clcid=0x409" target="_blank">Windows Azure Toolkit for Android</a>, the <a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=214684&amp;clcid=0x409" target="_blank">Windows Azure Toolkit for Windows Phone</a>, and a host of NuGet packages for Windows Phone and Windows Azure. All of these resources include native libraries (e.g. Objective-C for iOS and .NET for Windows Phone), sample applications, documentation, and tools. We also have a lot of videos and guides available to make the process of getting started as easy as possible.</p>
<p><strong><font size="3"><u>How can you help?</u></font></strong></p>
<p>One of my primary goals in 2012 is to continue to find and build compelling mobile applications that benefit from Windows Azure. We already have few great stories (see <a target="_blank" href="http://www.microsoft.com/casestudies/Windows-Azure/T-Mobile-USA/Mobile-Operator-Speeds-Time-to-Market-for-Innovative-Social-Networking-Solution/4000008598" target="_blank">T-Mobile USA</a>, <a target="_blank" href="http://www.microsoft.com/casestudies/Windows-Azure/Red-Badger/Creative-Software-Consultancy-Uses-Cloud-Operating-System-for-Twitter-Push-Alerts/4000011213" target="_blank">Red Badger</a>, <a target="_blank" href="http://www.microsoft.com/casestudies/Microsoft-Visual-Studio-Team-Foundation-Server-2010/easyJet/Airline-Aims-to-Save-Millions-Shorten-Airport-Waits-with-Cloud-Based-Mobile-Services/4000010767" target="_blank">easyJet</a>, and more) but that’s only scratching the surface – we can do a lot more!</p>
<p>So, I have a few questions of you:</p>
<ul>
<li>Are you building mobile applications that use services in Windows Azure? </li>
<li>Are you looking for additional PR and opportunities to highlight your applications? </li>
<li>Have you tried any of the toolkits or NuGet packages? </li>
<li>Do you have feedback for me regarding the use of the toolkits or NuGet packages? </li>
<li>What should we do that we aren’t today? </li>
<li>Do you have an application released to a marketplace – either Windows Phone, Apple, or Android – that uses Windows Azure? </li>
</ul>
<p>If you have any feedback to these questions then please contact me at <a target="_blank" href="mailto:wade.wegner@microsoft.com">wade.wegner@microsoft.com</a>. I want to hear from you!</p>
<p>Let’s see what we can accomplish together!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=zg1WYF0fxgg:bK5v7iziFxk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=zg1WYF0fxgg:bK5v7iziFxk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=zg1WYF0fxgg:bK5v7iziFxk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=zg1WYF0fxgg:bK5v7iziFxk:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/zg1WYF0fxgg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2012/01/are-you-building-mobile-cloud-applications-tell-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2012/01/are-you-building-mobile-cloud-applications-tell-me/</feedburner:origLink></item>
		<item>
		<title>How to Handle a Faulted Channel with the Windows Azure Service Bus</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/2R9hZNsVOyA/</link>
		<comments>http://www.wadewegner.com/2011/12/how-to-handle-a-faulted-channel-with-the-windows-azure-service-bus/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 04:52:51 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Service Bus]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/12/how-to-handle-a-faulted-channel-with-the-windows-azure-service-bus/</guid>
		<description><![CDATA[Recently I wrote a WCF service that fronted an on-premises SQL Server database for an MVC application running in a Window Azure Web Role. There are a number of ways I could have approached this scenario; I decided to use the netTcpRelayBinding via the Windows Azure Service Bus for the following reasons: I needed optimal [...]]]></description>
			<content:encoded><![CDATA[
<p>Recently I wrote a WCF service that fronted an on-premises SQL Server database for an MVC application running in a <a target="_blank" href="http://www.windowsazure.com/en-us/home/tour/compute/" target="_blank">Window Azure Web Role</a>. There are a number of ways I could have approached this scenario; I decided to use the <a target="_blank" href="http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.nettcprelaybinding.aspx" target="_blank">netTcpRelayBinding</a> via the <a target="_blank" href="http://www.windowsazure.com/en-us/home/tour/service-bus/" target="_blank">Windows Azure Service Bus</a> for the following reasons:</p>
<ul>
<li>I needed optimal performance (i.e. TCP over HTTP). </li>
<li>I wanted to reuse existing connections (rather than opening many connections). </li>
<li>I didn’t want to open up ports in my firewall (inbound or outbound). </li>
</ul>
<p>Based on these requirements, the Service Bus is almost a no brainer. The Service Bus provides both messaging and connectivity capabilities, the latter of which provide a nice way to build loosely coupled applications in hybrid scenarios (i.e. cloud + on-premises).</p>
<p>I dove right in and wrote the following code:</p>
<pre class="code"><span style="color: blue">public static </span><span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Customer</span>&gt; GetCustomers()
{
    <span style="color: #2b91af">Uri </span>serviceUri = <span style="color: #2b91af">ServiceBusEnvironment</span>.CreateServiceUri(<span style="color: #a31515">&quot;sb&quot;</span>,
        <span style="color: #a31515">&quot;MYSERVICENAMESPACE&quot;</span>, <span style="color: #a31515">&quot;Customer&quot;</span>);
    <span style="color: blue">var </span>customersChannelFactory = <span style="color: blue">new </span><span style="color: #2b91af">ChannelFactory</span>&lt;<span style="color: #2b91af">ICustomerChannel</span>&gt;(
        <span style="color: #a31515">&quot;RelayEndpoint&quot;</span>, <span style="color: blue">new </span><span style="color: #2b91af">EndpointAddress</span>(serviceUri));
    <span style="color: blue">var </span>customersChannel = customersChannelFactory.CreateChannel();
    customersChannel.Open();

    <span style="color: blue">return </span>customersChannel.GetCustomers();
}</pre>
<p>(I put much of the binding, client, and endpoint behaviors in the Web.Config.)</p>
<p>This code works but has problems. The channel to the Service Bus will open every time the service is called, resulting in suboptimal performance. To make this more efficient I decided to make the <font face="Courier New">ChannelFactory</font> and <font face="Courier New">Channel</font> variables statics so that I could reuse the channel if it had already been opened.</p>
<pre class="code"><span style="color: blue">static </span><span style="color: #2b91af">ChannelFactory</span>&lt;<span style="color: #2b91af">ICustomerChannel</span>&gt; customersChannelFactory;
<span style="color: blue">static </span><span style="color: #2b91af">ICustomerChannel </span>customersChannel;

<span style="color: blue">public static </span><span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Customer</span>&gt; GetCustomers()
{
    <span style="color: blue">if </span>(customersChannelFactory == <span style="color: blue">null </span>|| customersChannel == <span style="color: blue">null</span>)
    {
        <span style="color: #2b91af">Uri </span>serviceUri = <span style="color: #2b91af">ServiceBusEnvironment</span>.CreateServiceUri(<span style="color: #a31515">&quot;sb&quot;</span>,
            <span style="color: #a31515">&quot;MYSERVICENAMESPACE&quot;</span>, <span style="color: #a31515">&quot;Customer&quot;</span>);
        customersChannelFactory = <span style="color: blue">new </span><span style="color: #2b91af">ChannelFactory</span>&lt;<span style="color: #2b91af">ICustomerChannel</span>&gt;(
            <span style="color: #a31515">&quot;RelayEndpoint&quot;</span>, <span style="color: blue">new </span><span style="color: #2b91af">EndpointAddress</span>(serviceUri));
        customersChannel = customersChannelFactory.CreateChannel();
        customersChannel.Open();
    }

    <span style="color: blue">return </span>customersChannel.GetCustomers();
}</pre>
<p>This updated does a good job of improving the performance of the service call but has it’s own problems. When you create a <font face="Courier New">Channel</font> through the <font face="Courier New">ChannelFactory</font> your channel can enter a faulted state – with the Service Bus there are a number of ways that this can occur (in my testing it was because I often stopped/started the service host). When this happens the WCF communication static must be reset by recreating the client channel. </p>
<p>Finding an efficient – and somewhat elegant – way of handling the faulted state proved to be a fun challenge. Fortunately, I received a lot of help from folks on the Service Bus team.</p>
<p>In the end I went with the following code:</p>
<pre class="code"><span style="color: blue">static </span><span style="color: #2b91af">ChannelFactory</span>&lt;<span style="color: #2b91af">ICustomerChannel</span>&gt; customersChannelFactory;
<span style="color: blue">static </span><span style="color: #2b91af">ICustomerChannel </span>customersChannel;

<span style="color: blue">public static </span><span style="color: #2b91af">IEnumerable</span>&lt;<span style="color: #2b91af">Customer</span>&gt; GetCustomers()
{
    <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">Customer</span>&gt; customers = <span style="color: blue">null</span>;

    <span style="color: blue">if </span>(customersChannelFactory == <span style="color: blue">null</span>)
    {
        <span style="color: #2b91af">Uri </span>serviceUri = <span style="color: #2b91af">ServiceBusEnvironment</span>.CreateServiceUri(<span style="color: #a31515">&quot;sb&quot;</span>,
            <span style="color: #a31515">&quot;MYSERVICENAMESPACE&quot;</span>, <span style="color: #a31515">&quot;Customer&quot;</span>);
        customersChannelFactory = <span style="color: blue">new </span><span style="color: #2b91af">ChannelFactory</span>&lt;<span style="color: #2b91af">ICustomerChannel</span>&gt;(
            <span style="color: #a31515">&quot;RelayEndpoint&quot;</span>, <span style="color: blue">new </span><span style="color: #2b91af">EndpointAddress</span>(serviceUri));
    }

    <span style="color: blue">int </span>tries = 0;
    <span style="color: blue">while </span>(tries++ &lt; 3)
    {
        <span style="color: blue">try
        </span>{
            <span style="color: blue">if </span>(customersChannel == <span style="color: blue">null</span>)
            {
                customersChannel = customersChannelFactory.CreateChannel();
                customersChannel.Open();
            }

            <span style="color: blue">return </span>customersChannel.GetCustomers();
        }
        <span style="color: blue">catch </span>(<span style="color: #2b91af">CommunicationException</span>)
        {
            customersChannel.Abort();
            customersChannel = <span style="color: blue">null</span>;
        }
    }

    <span style="color: blue">return </span>customers;
}</pre>
<p>More verbose but much, much better.</p>
<p>The key is correctly handling the <font face="Courier New">CommunicationException</font>, aborting the channel, and setting the channel to null. Since we have retry logic via the while loop it will try again, determine that the channel is null, and re-open the channel.</p>
<p>There are certainly other ways to do this correctly. For example, you could decide to create a <a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb350915.aspx" target="_blank">Faulted event handler</a>.</p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=2R9hZNsVOyA:x5QPJ4lQhwM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=2R9hZNsVOyA:x5QPJ4lQhwM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=2R9hZNsVOyA:x5QPJ4lQhwM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=2R9hZNsVOyA:x5QPJ4lQhwM:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/2R9hZNsVOyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/12/how-to-handle-a-faulted-channel-with-the-windows-azure-service-bus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/12/how-to-handle-a-faulted-channel-with-the-windows-azure-service-bus/</feedburner:origLink></item>
		<item>
		<title>Unable to find assembly references that are compatible with the target framework ‘Silverlight,Version=v4.0, Profile=WindowsPhone71′</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/m0TI6Dc0ueo/</link>
		<comments>http://www.wadewegner.com/2011/11/unable-to-find-assembly-references-that-are-compatible-with-the-target-framework-silverlightversionv4-0-profilewindowsphone71/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 18:18:18 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[NuGet]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/?p=1730</guid>
		<description><![CDATA[Yes, that title is a mouthful. But this title is as cryptic as the error that can get generated when trying to install a NuGet package: Install-Package : Unable to find assembly references that are compatible with the target framework 'Silverlight,Version=v4.0,Profile=WindowsPhone71'. At line:1 char:16 + Install-Package &#60;&#60;&#60;&#60; Phone.Storage + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException [...]]]></description>
			<content:encoded><![CDATA[
<p>Yes, that title is a mouthful. But this title is as cryptic as the error that can get generated when trying to install a NuGet package:</p>
<pre>    Install-Package : Unable to find assembly references that are compatible with the target
    framework 'Silverlight,Version=v4.0,Profile=WindowsPhone71'.

    At line:1 char:16
    + Install-Package &lt;&lt;&lt;&lt;  Phone.Storage
        + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
        + FullyQualifiedErrorId : NuGetCmdletUnhandledException,
          NuGet.PowerShell.Commands.InstallPackageCommand</pre>
<p>Here’s what you’ll see in Visual Studio:</p>
<p><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="NuGetErrorMessage" border="0" alt="NuGetErrorMessage" src="http://images.wadewegner.com/wordpress/2011/11/NuGetErrorMessage.jpg" width="640" height="215" /></p>
<p>This is the error I get when trying to install one of our <a href="http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/" target="_blank">NuGet packages</a> on a freshly built machine. Long story short, the reason is that I don’t have the latest NuGet Package Manager.</p>
<p>Take a look at Extension Manager and observe the version number associated with the NuGet Package Manager:</p>
<p><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="OldNuGet" border="0" alt="OldNuGet" src="http://images.wadewegner.com/wordpress/2011/11/OldNuGet.jpg" width="721" height="171" /></p>
<p>See that the version is 1.2? We need to update it to version 1.5. Head to <a target="_blank" href="http://nuget.org">http://nuget.org</a> and from there click to install NuGet. Once you’ve completed the installation you should confirm that you now have version 1.5:</p>
<p><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="NewNuGet" border="0" alt="NewNuGet" src="http://images.wadewegner.com/wordpress/2011/11/NewNuGet.jpg" width="721" height="172" /></p>
<p>So now, when you try to install a NuGet package such as Phone.Storage you won’t have any problems.</p>
<p><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="NuGetWorking" border="0" alt="NuGetWorking" src="http://images.wadewegner.com/wordpress/2011/11/NuGetWorking.jpg" width="640" height="219" /></p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=m0TI6Dc0ueo:lVh-my5EH1M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=m0TI6Dc0ueo:lVh-my5EH1M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=m0TI6Dc0ueo:lVh-my5EH1M:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=m0TI6Dc0ueo:lVh-my5EH1M:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/m0TI6Dc0ueo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/unable-to-find-assembly-references-that-are-compatible-with-the-target-framework-silverlightversionv4-0-profilewindowsphone71/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/unable-to-find-assembly-references-that-are-compatible-with-the-target-framework-silverlightversionv4-0-profilewindowsphone71/</feedburner:origLink></item>
		<item>
		<title>Adding Push Notification Support to Your Windows Phone Application</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/5RSiXgltk58/</link>
		<comments>http://www.wadewegner.com/2011/11/adding-push-notification-support-to-your-windows-phone-application/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 22:32:00 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Deep Linking]]></category>
		<category><![CDATA[NuGet]]></category>
		<category><![CDATA[Push Notification]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/11/adding-push-notification-support-to-your-windows-phone-application/</guid>
		<description><![CDATA[A couple days ago I wrote a post on outsourcing user authentication in a Windows Phone application, demonstrating how easy it is to leverage the Windows Azure Access Control service in your Windows Phone application. The solution is built using a set of NuGet packages that our team has built for Windows Phone + Windows [...]]]></description>
			<content:encoded><![CDATA[
<p>A couple days ago I wrote a post on <a href="http://www.wadewegner.com/2011/11/outsourcing-user-authentication-in-a-windows-phone-application/" target="_blank">outsourcing user authentication in a Windows Phone application</a>, demonstrating how easy it is to leverage the Windows Azure Access Control service in your Windows Phone application. The solution is built using a <a href="http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/" target="_blank">set of NuGet packages</a> that our team has built for Windows Phone + Windows Azure – they provide a similar development experience by allowing you to better manage dependencies and compose great application experiences on the Windows Phone.</p>
<p>Today I want to show a similar way to build support for sending push notifications to Windows Phone applications.</p>
<p>Push notifications provide you a way to deliver information to your applications that are installed on someone’s Windows Phone. It can help provide a key way to differentiate your application from other applications – especially when you tap into tile notifications and take advantage of background tiles, deep linking, and the like. There are a lot of great blog posts on this topic:</p>
<ul>
<li><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ff402558%28v=VS.92%29.aspx" target="_blank">Push Notifications Overview for Windows Phone</a> </li>
<li><a target="_blank" href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/05/03/understanding-microsoft-push-notifications-for-windows-phones.aspx" target="_blank">Understanding Microsoft Push Notifications for Windows Phones</a> (somewhat old) </li>
<li><a target="_blank" href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/05/04/understanding-how-microsoft-push-notification-works-part-2.aspx" target="_blank">Understanding How Microsoft Push Notification Works</a> (somewhat old) </li>
<li><a target="_blank" href="http://www.jeffblankenburg.com/2011/11/11/31-days-of-mango-day-11-live-tiles/" target="_blank">Live Tiles</a> (part of the <a target="_blank" href="http://www.jeffblankenburg.com/2011/10/31/31-days-of-mango/" target="_blank">31 Days of Mango</a> series) </li>
</ul>
<p>One problem I’ve observed with push notifications is most people aren’t sure what to do with the channel URI’s received from the Microsoft Push Notification Service (MPNS). Developers also don’t know where or how to send messages to the device—should it be a service, and if so, where does it run? This is where Windows Azure can provide a lot of help.</p>
<p>Through the Windows Azure Toolkit for Windows Phone, we’ve been providing push notification services for quite a long time. It’s a great solution, and one that has helped a lot of folks. However, it was also relatively difficult to take our samples and then update them such that they worked in your applications. This is where the NuGet packages come into play. We’ve completely refactored the underlying libraries and now deliver all the capabilities as individual NuGets – you can easily create a new Windows Phone application—or update an existing one—using these NuGets.</p>
<p>A few comments on how these NuGets collaborate with the Windows Phone and the MPNS:</p>
<ol>
<li><strong>The Windows Phone Application registers in the MPNS</strong>: The Windows Phone application opens a notification channel to the MPNS and indicates that it wishes to receive push notification messages. The MPNS creates a subscription endpoint associated with that particular channel and forwards it to the Windows Phone device (and the specific application) using the channel it’s just opened. The MPNS sends the endpoint to the application so that the application can send it to the service from which it plans to receive notifications. </li>
<li><strong>The Windows Phone Client registers with the Web Role</strong>: The Windows Phone application invokes a service in the Web Role to register itself with the subscription endpoint received from the MPNS. This endpoint is the URI to which the cloud application will perform the HTTP POSTs to send push notification messages to the device. </li>
<li><strong>The Cloud Service sends a notification request to the MPNS</strong>: The cloud services sends a notification request by doing a HTTP POST in a specific XML format defined by the MPNS protocol to the subscription endpoint associated with the device it wants to notify. </li>
<li><strong>The MPNS sends the notification to the Windows Phone device</strong>: The MPNS transforms the notification request it received to a proper Push Notification to send to the Windows Phone device associated with the endpoint where it received the notification request. The notification request can ask for a toast, a tile, or a raw notification. Once the device receives the push notification via the Push Client it will route the notification to the Shell, which will take an action according to the status of the application. If the application is not running, the shell will either update the application tile, or show a toast. If the application is running, it will send the notification to the already running application. </li>
</ol>
<p>This architectural picture should help explain the interactions:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Architecture" border="0" alt="Architecture" src="http://images.wadewegner.com/wordpress/2011/11/Architecture.png" width="777" height="399" /></p>
<p>As with the Windows Phone and ACS example, I want to walk you through the whole process. There’s certainly more that you can do, but I think you’ll agree that the following is quite compelling.</p>
<ol>
<li>Create a new Windows Phone OS 7.1 application.      <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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="NewWindowsPhoneApplication7.1" border="0" alt="NewWindowsPhoneApplication7.1" src="http://images.wadewegner.com/wordpress/2011/11/NewWindowsPhoneApplication7.1.jpg" width="413" height="195" /> </li>
<li>From the <strong>Package Manager Console</strong> type the following to install the ACS base login page NuGet package for Windows Phone: <font face="Courier New">Install-Package Phone.Notifications.BasePage</font><font face="Calibri">.        <br /></font><img style="background-image: none; border-right-width: 0px; margin: 10px 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="Phone.Notifications.BasePage" border="0" alt="Phone.Notifications.BasePage" src="http://images.wadewegner.com/wordpress/2011/11/Phone.Notifications.BasePage.jpg" width="635" height="237" /> </li>
<li>Update the<strong> WMAppManifest.xml</strong> file so that the default page is the <strong>Push.xaml</strong>. This way the user will come to the login page before the <strong>MainPage.xaml.        <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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="WMAppManifest" border="0" alt="WMAppManifest" src="http://images.wadewegner.com/wordpress/2011/11/WMAppManifest.jpg" width="691" height="255" /></strong> </li>
<li>Let’s create a page that we can use to demonstration deep linking with MPNS. Create a new <strong>Windows Phone Portrait Page</strong> called <strong>DeepLinkPage.xaml</strong> in the <strong>Pages</strong> folder. </li>
<li>In the <strong>ContentPanel</strong> grid, add a <strong>TextBlock </strong>control. We’ll push a message to this control when sending a notification.
<pre class="code">    <span style="color: blue">&lt;</span><span style="color: #a31515">TextBlock </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;QueryString&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;Query string&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;9,10,0,0&quot;
        </span><span style="color: red">Style</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">StaticResource </span><span style="color: red">PhoneTextTitle2Style</span><span style="color: blue">}&quot;/&gt;
</span></pre>
</li>
<li>We need to write the handler that will write the code to the <strong>TextBlock</strong>.
<pre class="code"><span style="color: blue">    protected override void </span>OnNavigatedTo(<span style="color: #2b91af">NavigationEventArgs </span>e)
    {
        <span style="color: blue">if </span>(<span style="color: blue">this</span>.NavigationContext.QueryString.ContainsKey(<span style="color: #a31515">&quot;message&quot;</span>))
        {
            <span style="color: blue">this</span>.QueryString.Text = <span style="color: blue">this</span>.NavigationContext.QueryString[<span style="color: #a31515">&quot;message&quot;</span>];
        }
        <span style="color: blue">else
        </span>{
            <span style="color: blue">this</span>.QueryString.Text = <span style="color: #a31515">&quot;no message was received.&quot;</span>;
        }
    }</pre>
</li>
<li>That’s all there is to do in the Windows Phone client. Now we have to write the services that will store the Channel URI generated by MPNS and allow us to send notifications to the device. Add a new <strong>Windows Azure Project </strong>to the solution. Select the <strong>Internet Application</strong> template using the <strong>HTML 5 semantic markup</strong>.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="WindowsAzureProject" border="0" alt="WindowsAzureProject" src="http://images.wadewegner.com/wordpress/2011/11/WindowsAzureProject.jpg" width="639" height="400" /></p>
</li>
<li>From the <strong>Package Manager Console</strong>, change the default project to <strong>Web</strong> (or whatever you called your MVC 3 web application), and then type the following to install the MPNS push notifications services and libraries into the web applications: <font face="Courier New">Install-Package WindowsAzure.Notifications</font>. The services installed will let clients register (and unregister) for receiving push notification messages.
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WindowsAzure.Notifications" border="0" alt="WindowsAzure.Notifications" src="http://images.wadewegner.com/wordpress/2012/01/WindowsAzure.Notifications.png" width="709" height="240" /></p>
</li>
<li>At this point we don’t have any means for sending a notification. To make this easier, we’ve built a sample management UI for Windows Phone that allows you to manually send push notifications to registered devices. This registers a sample MVC Area called “Notifications” containing the UI and the MPNS Recipe for sending all the supported types of push notifications.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="WindowsPhone.Notifications.ManagementUI.Sample" border="0" alt="WindowsPhone.Notifications.ManagementUI.Sample" src="http://images.wadewegner.com/wordpress/2011/11/WindowsPhone.Notifications.ManagementUI.Sample.jpg" width="523" height="237" /> </p>
</li>
<li>At this point you’re ready to roll! Hit <strong>Control-F5 </strong>to build and run. When your website starts browse to http://127.0.0.1:81/notifications and notice that you don’t have any clients currently registered.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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://images.wadewegner.com/wordpress/2011/11/image.png" width="700" height="441" /></p>
</li>
<li>In the Windows Phone emulator, click to <strong>Enable push notifications</strong>. Wait until you receive confirmation that the channel has successfully registered.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="RegisterChannel" border="0" alt="RegisterChannel" src="http://images.wadewegner.com/wordpress/2011/11/RegisterChannel.jpg" width="264" height="480" /></p>
</li>
<li>Reload the notifications page and you’ll see that you now have a registered channel.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="RegisteredChannel" border="0" alt="RegisteredChannel" src="http://images.wadewegner.com/wordpress/2011/11/RegisteredChannel.jpg" width="640" height="320" /> </p>
</li>
<li>Click the <strong>Send Notification</strong>. Select the <strong>Raw</strong> notification type, type a message, and click <strong>send</strong>.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="SendRawMessage" border="0" alt="SendRawMessage" src="http://images.wadewegner.com/wordpress/2011/11/SendRawMessage.jpg" width="640" height="341" /></p>
</li>
<li>In your application on the Windows Phone emulator you should receive the message. This is great – we’ve just received a push notification message in our application.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="RawMessageReceived" border="0" alt="RawMessageReceived" src="http://images.wadewegner.com/wordpress/2011/11/RawMessageReceived.jpg" width="264" height="480" /> </p>
</li>
<li>On the device emulator, click the Windows button, pan to the right, and pin the <strong>PushNotifications</strong> application to start. </li>
<li>Now, from the website, click <strong>Send Notification</strong>. This time select a <strong>Tile </strong>notification type. Change the <strong>Title</strong>, set the <strong>Count</strong>, and choose a <strong>Background Image</strong>. Click <strong>Send</strong>.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="SendTileMessage" border="0" alt="SendTileMessage" src="http://images.wadewegner.com/wordpress/2011/11/SendTileMessage.jpg" width="640" height="341" /></p>
</li>
<li>Notice how the <strong>title</strong>, <strong>tile</strong> <strong>background</strong>, and <strong>count</strong> have now updated on the device!
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="ReceivedTileMessage" border="0" alt="ReceivedTileMessage" src="http://images.wadewegner.com/wordpress/2011/11/ReceivedTileMessage.jpg" width="264" height="480" /></p>
</li>
<li>Lastly, from the website, click <strong>Send Notification</strong>. This time select a <strong>Toast </strong>notification type. Set a <strong>Title</strong>, <strong>Sub Title</strong>, and set the <strong>Target Page </strong>to: <font face="Courier New">/Pages/DeepLinkPage.xaml?message=Hello</font><font face="Calibri">. Click <strong>Send</strong>.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="SendToastMessage" border="0" alt="SendToastMessage" src="http://images.wadewegner.com/wordpress/2011/11/SendToastMessage.jpg" width="640" height="341" /></p>
<p>    </font></li>
<li>You’ll receive a toast message (i.e “<strong>Title</strong> <strong>Sub Title</strong>”) on the device. Click it. This will open up the DeepLink.xaml page and pass along the message “Hello” that was sent in the toast.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px 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="ReceiveToastMessage" border="0" alt="ReceiveToastMessage" src="http://images.wadewegner.com/wordpress/2011/11/ReceiveToastMessage.jpg" width="528" height="480" /></p>
</li>
</ol>
<p>And that’s it! You can now quickly enrich your Windows Phone applications by leveraging push notifications.</p>
<p>While the Sample UI works great for development, you’ll most likely want to go a few steps further and write your own services or processes to generate notifications. Worker roles with queues work great in this space – I’ll definitely write about this in the future.</p>
<p>Long story short, the following three NuGet packages make it really easy to take advantage of Push Notifications on the Windows Phone using Windows Azure:</p>
<ul>
<li>Install-Package <a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Notifications.BasePage" target="_blank">Phone.Notifications.BasePage</a> </li>
<li>Install-Package <a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Notifications" target="_blank">WindowsAzure.Notifications</a> </li>
<li>Install-Package <a target="_blank" href="http://www.nuget.org/List/Packages/WindowsPhone.Notifications.ManagementUI.Sample" target="_blank">WindowsPhone.Notifications.ManagementUI.Sample</a> </li>
</ul>
<p>Give it a try and tell me if you agree.</p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=5RSiXgltk58:Jqntzd4GRBQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=5RSiXgltk58:Jqntzd4GRBQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=5RSiXgltk58:Jqntzd4GRBQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=5RSiXgltk58:Jqntzd4GRBQ:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/5RSiXgltk58" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/adding-push-notification-support-to-your-windows-phone-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/adding-push-notification-support-to-your-windows-phone-application/</feedburner:origLink></item>
		<item>
		<title>Outsourcing User Authentication in a Windows Phone Application</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/EEQRoiK-Mng/</link>
		<comments>http://www.wadewegner.com/2011/11/outsourcing-user-authentication-in-a-windows-phone-application/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 05:18:58 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Access Control Service]]></category>
		<category><![CDATA[NuGet]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/11/outsourcing-user-authentication-in-a-windows-phone-application/</guid>
		<description><![CDATA[Yesterday I shared all the NuGet packages we’re building to make it easy to build Windows Phone and Windows Azure applications. Today I wanted to share how easy it is to build a Windows Phone application that leverages the Windows Azure Access Control service. The Phone.Identity.AccessControl.BasePage NuGet package includes a control for Window Phone that [...]]]></description>
			<content:encoded><![CDATA[
<p>Yesterday I shared all the <a target="_blank" href="http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/" target="_blank">NuGet packages we’re building</a> to make it easy to build Windows Phone and Windows Azure applications. Today I wanted to share how easy it is to build a Windows Phone application that leverages the <a href="http://www.microsoft.com/windowsazure/features/accesscontrol/" target="_blank">Windows Azure Access Control service</a>.</p>
<p>The <strong>Phone.Identity.AccessControl.BasePage</strong> NuGet package includes a control for Window Phone that allows your phone applications to outsource user authentication to the Windows Azure Access Control service (ACS). This service enables your users to login by reusing their existing accounts from identity providers such as Windows Live ID, Google, Yahoo, Facebook, and even Active Directory. If you want to know more about ACS you can take a look at the dedicated hands-on labs in the <a target="_blank" href="http://msdn.microsoft.com/gg271268">Windows Azure Platform Training Course</a>.</p>
<p>Using this NuGet package and the included control for ACS in your Windows Phone applications takes care of all the runtime interactions with ACS. Additionally, this package provides a base login page that uses the control and is easy to setup in your phone application. All that is left for you to do is to configure your ACS namespace via the management portal (i.e. specifying your preferences such as the identity providers you want to enable in your application) and integrate the login page into your existing Windows Phone application.</p>
<p>For more information on setting up ACS take a look at the resources at <a target="_blank" href="http://acs.codeplex.com/">http://acs.codeplex.com/</a></p>
<p>To help simplify the process below, I’m making the assumption you already have ACS setup and configured. I’ll be using the following values in the below sample (no guarantee that they’ll be available when you read this post but I’ll do my best):</p>
<ul>
<li><strong>namespace</strong>: watwindowsphone </li>
<li><strong>realm</strong>: uri:watwindowsphone </li>
</ul>
<p>Without further ado, here are the steps to build a Windows Phone application that outsources authentication to ACS:</p>
<ol>
<li>Create a new <strong>Windows Phone OS 7.1</strong> application.       <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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="WindowsPhoneOS71" border="0" alt="WindowsPhoneOS71" src="http://images.wadewegner.com/wordpress/2011/11/WindowsPhoneOS71.jpg" width="527" height="249" /> </li>
<li>From the <strong>Package Manager Console</strong> type the following to install the ACS base login page NuGet package for Windows Phone: <span style="font-family: courier new">Install-Package Phone.Identity.AccessControl.BasePage        <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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="InstallPackage" border="0" alt="InstallPackage" src="http://images.wadewegner.com/wordpress/2011/11/InstallPackage.jpg" width="758" height="236" /></span> </li>
<li>Update the <strong>AccessControlResources.xaml </strong>resources file to use your ACS namespace and the realm you have configured.
<pre class="code">    <span style="color: blue">&lt;</span><span style="color: #a31515">system</span><span style="color: blue">:</span><span style="color: #a31515">String </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Key</span><span style="color: blue">=&quot;acsNamespace&quot;&gt;</span><span style="color: #a31515">watwindowsphone</span><span style="color: blue">&lt;/</span><span style="color: #a31515">system</span><span style="color: blue">:</span><span style="color: #a31515">String</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">system</span><span style="color: blue">:</span><span style="color: #a31515">String </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Key</span><span style="color: blue">=&quot;realm&quot;&gt;</span><span style="color: #a31515">uri:watwindowsphone</span><span style="color: blue">&lt;/</span><span style="color: #a31515">system</span><span style="color: blue">:</span><span style="color: #a31515">String</span><span style="color: blue">&gt;
</span></pre>
</li>
<li>Update the<strong> WMAppManifest.xml</strong> file so that the default page is the <strong>LoginPage.xaml</strong>. This way the user will come to the login page before the <strong>MainPage.xaml</strong>.<img style="background-image: none; border-right-width: 0px; margin: 10px 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="WMAManifiest" border="0" alt="WMAManifiest" src="http://images.wadewegner.com/wordpress/2011/11/WMAManifiest.jpg" width="694" height="281" /> </li>
<li>Update the <strong>LoginPage.xaml.cs</strong> so that the user is navigated to the <strong>MainPage.xaml </strong>upon successfully logging into the application. Make sure to update <strong>Line 23 </strong>and <strong>Line 33</strong>.
<pre class="code"><span style="color: blue"> this</span>.NavigationService.Navigate(<span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #a31515">&quot;/MainPage.xaml&quot;</span>, <span style="color: #2b91af">UriKind</span>.Relative));</pre>
</li>
<li>Let’s display some information from the Simple Web Token. Add a <strong>TextBlock</strong> control to the <strong>MainPage.xaml </strong>page.&#160;
<pre class="code">    <span style="color: green">&lt;!--ContentPanel - place additional content here--&gt;
    </span><span style="color: blue">&lt;</span><span style="color: #a31515">Grid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;ContentPanel&quot; </span><span style="color: red">Grid.Row</span><span style="color: blue">=&quot;1&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;12,0,12,0&quot;&gt;
        &lt;</span><span style="color: #a31515">TextBlock </span><span style="color: red">Name</span><span style="color: blue">=&quot;DisplayLoginInfo&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
</span></pre>
</li>
<li>Add a Loaded event for the <strong>MainPage.xaml</strong>. In this event you’ll want to load the <strong>simpleWebTokenStore</strong> out of the application resources. You can then use it to grab resources like the name identifier or various other claim types (like Name). Finish by updating the <strong>DisplayLoginInfo</strong>textblock.
<pre class="code"><span style="color: blue">    using </span>Microsoft.WindowsAzure.Samples.Phone.Identity.AccessControl;

    ...

<span style="color: blue">    var </span>simpleWebTokenStore = <span style="color: #2b91af">Application</span>.Current.Resources[<span style="color: #a31515">&quot;swtStore&quot;</span>]
        <span style="color: blue">as </span><span style="color: #2b91af">SimpleWebTokenStore</span>;

<span style="color: blue">    var </span>userNameIdentifier = simpleWebTokenStore.SimpleWebToken.NameIdentifier;
<span style="color: blue">    var </span>name = simpleWebTokenStore.SimpleWebToken.Claims[<span style="color: #2b91af">ClaimTypes</span>.Name];

<span style="color: blue">    this</span>.DisplayLoginInfo.Text =
        <span style="color: #a31515">&quot;Identifier: &quot; </span>+ userNameIdentifier + <span style="color: #2b91af">Environment</span>.NewLine +
        <span style="color: #a31515">&quot;Name: &quot; </span>+ name;</pre>
</li>
<li>Run the application. I’d recommend using Facebook, Google, or Yahoo! for the identity providers, as Live ID does not provide the name claim type in the SWT token.<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="LoginExperience" border="0" alt="LoginExperience" src="http://images.wadewegner.com/wordpress/2011/11/LoginExperience.jpg" width="757" height="426" /> </li>
</ol>
<p>And that’s it! You can now take advantage of the Identifier claim (and others) in your phone application for many things – tracking users, displaying additional user information, and so forth. Additionally, you can use these claims to authenticate against additional services running in Windows Azure – I’ll cover this token in a future post.</p>
<p>The <strong>Phone.Identity.AccessControl.BasePage </strong>NuGet package makes it really easy for you to take advantage of the Windows Azure Access Control service within your applications. ACS provides a great way for you to leverage your users existing identity providers when using your application.</p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=EEQRoiK-Mng:zeWPPlGRLVo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=EEQRoiK-Mng:zeWPPlGRLVo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=EEQRoiK-Mng:zeWPPlGRLVo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=EEQRoiK-Mng:zeWPPlGRLVo:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/EEQRoiK-Mng" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/outsourcing-user-authentication-in-a-windows-phone-application/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/outsourcing-user-authentication-in-a-windows-phone-application/</feedburner:origLink></item>
		<item>
		<title>Programmatically Installing and Using Your Management Certificate with the New .publishsettings File</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/PDwdKMHhFHI/</link>
		<comments>http://www.wadewegner.com/2011/11/programmatically-installing-and-using-your-management-certificate-with-the-new-publishsettings-file/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:11:10 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[Service Management API]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[X509Certificates]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/11/programmatically-installing-and-using-your-management-certificate-with-the-new-publishsettings-file/</guid>
		<description><![CDATA[Earlier this week we released the Windows Azure SDK 1.6, which includes a lot of great updates to the emulators, tools for Visual Studio, and libraries. One of my favorite additions is a new way to get a management certificate installed into Windows Azure and onto your machine. You can now browse to https://windows.azure.com/download/publishprofile.aspx and [...]]]></description>
			<content:encoded><![CDATA[
<p>Earlier this week we released the <a target="_blank" href="http://blogs.msdn.com/b/windowsazure/archive/2011/11/14/updated-windows-azure-sdk-amp-windows-azure-hpc-scheduler-sdk.aspx" target="_blank">Windows Azure SDK 1.6</a>, which includes a lot of great updates to the emulators, tools for Visual Studio, and libraries. One of my favorite additions is a new way to get a management certificate installed into Windows Azure and onto your machine. You can now browse to <a target="_blank" href="https://windows.azure.com/download/publishprofile.aspx">https://windows.azure.com/download/publishprofile.aspx</a> and login with your Live ID; this process will do two things:</p>
<ol>
<li>Generate a management certificate that is installed into Windows Azures on your behalf. </li>
<li>Prompts you to download a <font face="Courier New">.publishsettings </font>file which includes an encoded version of your certificate and all of your subscription IDs. </li>
</ol>
<p>The new tools for Visual Studio let you easily important this file and immediately start working with your subscriptions from within Visual Studio. It’s a <em>much</em> simpler experience than in the past. In fact, on this weeks episode of the Cloud Cover Show (not yet published) Steve and I cover how to use this file from within your own code. While Steve beat me to it and <a target="_blank" href="http://blog.smarx.com/posts/calling-the-windows-azure-service-management-api-with-the-new-publishsettings-file" target="_blank">published a great blog post</a> showing some of the things you can do, I thought I’d take this a slightly different way and show you a couple different things:</p>
<ul>
<li>How to install the certificate into your personal certificate store (which is exactly what Visual Studio is doing). </li>
<li>How to use the certificate from your person certificate store to make calls to the Service Management API. </li>
</ul>
<p>The code is very similar. Take a look:</p>
<ol>
<pre class="code"><span style="color: blue">var </span>publishSettingsFile =
    <span style="color: #a31515">@&quot;C:\\temp\\CORP DPE Account-11-16-2011-credentials.publishsettings&quot;</span>;
<span style="clear: both">
<span style="color: #2b91af">XDocument </span>xdoc = <span style="color: #2b91af">XDocument</span>.Load(publishSettingsFile);
<span style="clear: both">
<span style="color: blue">var </span>managementCertbase64string =
    xdoc.Descendants(<span style="color: #a31515">&quot;PublishProfile&quot;</span>).Single().Attribute(<span style="color: #a31515">&quot;ManagementCertificate&quot;</span>).Value;
<span style="clear: both">
<span style="color: blue">var </span>importedCert = <span style="color: blue">new </span><span style="color: #2b91af">X509Certificate2</span>(
    <span style="color: #2b91af">Convert</span>.FromBase64String(managementCertbase64string));</pre>
</ol>
<p>Now that we’ve imported the certificate, we can extract some information. I’ll grab the certificate thumbprint, which uniquely identifies the certificate—we’ll use it later in the post.</p>
<ol>
<pre class="code"><span style="color: blue">string </span>thumbprint = importedCert.Thumbprint;</pre>
</ol>
<p>Additionally, I can grab my subscription ID from the <font face="Courier New">.publishsettings</font> file – this we will also use later.</p>
<ol>
<pre class="code"><span style="color: blue">string </span>subscriptionId = xdoc.Descendants(<span style="color: #a31515">&quot;Subscription&quot;</span>).First().Attribute(<span style="color: #a31515">&quot;Id&quot;</span>).Value;</pre>
</ol>
<p>Now, we can take our <span style="color: #2b91af"><font face="Courier New">X509Certificate2</font> </span>and install it directly into our certificate store.</p>
<ol>
<pre class="code"><span style="color: #2b91af">X509Store </span>store = <span style="color: blue">new </span><span style="color: #2b91af">X509Store</span>(<span style="color: #2b91af">StoreName</span>.My);
store.Open(<span style="color: #2b91af">OpenFlags</span>.ReadWrite);
store.Add(importedCert);
store.Close();</pre>
</ol>
<p>After running this code, you can see that the certificate has been installed into my personal certificate store.</p>
<p><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="CertMgr" border="0" alt="CertMgr" src="http://images.wadewegner.com/wordpress/2011/11/CertMgr.png" width="650" height="264" /></p>
<p>If you select the certificate you’ll see that it’s the same certificate with the same thumbprint.</p>
<p><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="certificate" border="0" alt="certificate" src="http://images.wadewegner.com/wordpress/2011/11/certificate.png" width="276" height="343" /></p>
<p>Since the certificate is now loaded into the certificate store I can delete the <font face="Courier New">.publishsettings</font> file – I no longer need it. (It’s also a credential that I don’t want to let anyone else get their hands on.)</p>
<p>Now I have the following resources available to me:</p>
<ul>
<li>My X509 certificate loaded in my personal certificate store. </li>
<li>The thumbprint for the certificate (which we’ll use to identify the right certificate). </li>
<li>My Windows Azure subscription ID. </li>
</ul>
<p>With this information we can do the exact same thing Steve shows in his post except without the <font face="Courier New">.publishsettings</font> file.</p>
<ol>
<pre class="code"><span style="color: #2b91af">X509Store </span>store = <span style="color: blue">new </span><span style="color: #2b91af">X509Store</span>(<span style="color: #2b91af">StoreName</span>.My);
store.Open(<span style="color: #2b91af">OpenFlags</span>.ReadWrite);
<span style="color: #2b91af">X509Certificate2 </span>managementCert =
    store.Certificates.Find(<span style="color: #2b91af">X509FindType</span>.FindByThumbprint, thumbrprint, <span style="color: blue">false</span>)[0];
<span style="clear: both">
<span style="color: blue">var </span>req = (<span style="color: #2b91af">HttpWebRequest</span>)<span style="color: #2b91af">WebRequest</span>.Create(
    <span style="color: blue">string</span>.Format(<span style="color: #a31515">&quot;https://management.core.windows.net/{0}/services/hostedservices&quot;</span>,
    subscriptionId));
<span style="clear: both">
req.Headers[<span style="color: #a31515">&quot;x-ms-version&quot;</span>] = <span style="color: #a31515">&quot;2011-10-01&quot;</span>;
req.ClientCertificates.Add(managementCert);
<span style="clear: both">
<span style="color: #2b91af">XNamespace </span>xmlns = <span style="color: #a31515">&quot;http://schemas.microsoft.com/windowsazure&quot;</span>;
<span style="clear: both">
<span style="color: #2b91af">Console</span>.WriteLine(<span style="color: blue">string</span>.Join(<span style="color: #a31515">&quot;\n&quot;</span>,
    <span style="color: #2b91af">XDocument</span>.Load(req.GetResponse().GetResponseStream())
    .Descendants(xmlns + <span style="color: #a31515">&quot;ServiceName&quot;</span>).Select(n =&gt; n.Value).ToArray()));</pre>
<p>  <span style="clear: both"><span style="clear: both"><span style="clear: both"><span style="clear: both"></span></span></span></span></ol>
<p>Essentially, we can grab the certificate out of the certificate store using the thumbprint and then make the exact same call to the service management API.</p>
<p>The console output below shows that I’m able to get a list of all my hosted services:</p>
<p><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="Console" border="0" alt="Console" src="http://images.wadewegner.com/wordpress/2011/11/Console.png" width="677" height="342" /></p>
<p>It’s as simple as that!</p>
<p>I’m not sure that this post applies to everyone—in fact, most of you may find it boring or cryptic—but for those of you that are building content or tools you’ll probably find this a really simple way to automate a lot of the pieces. I know that my team plans to use these techniques in a lot of places to simply the experience of getting started with Windows Azure.</p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=PDwdKMHhFHI:z1gY25Cngmw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=PDwdKMHhFHI:z1gY25Cngmw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=PDwdKMHhFHI:z1gY25Cngmw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=PDwdKMHhFHI:z1gY25Cngmw:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/PDwdKMHhFHI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/programmatically-installing-and-using-your-management-certificate-with-the-new-publishsettings-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/programmatically-installing-and-using-your-management-certificate-with-the-new-publishsettings-file/</feedburner:origLink></item>
		<item>
		<title>NuGet Packages for Windows Azure and Windows Phone Developers</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/1GvSmRq6TJU/</link>
		<comments>http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 22:21:30 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[ACS]]></category>
		<category><![CDATA[NuGet]]></category>
		<category><![CDATA[Push Notification]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/</guid>
		<description><![CDATA[If you’ve been paying attention to the Windows Azure Toolkit for Windows Phone (or my twitter feed) the last couple weeks, you’ve probably noticed something about NuGet packages. We’ve been building a lot of Windows Phone and Windows Azure NuGet packages that, when composed together, give you the ability to quickly build some cool applications. [...]]]></description>
			<content:encoded><![CDATA[
<p>If you’ve been paying attention to the <a target="_blank" href="http://watwp.codeplex.com/" target="_blank">Windows Azure Toolkit for Windows Phone</a> (or my <a target="_blank" href="http://twitter.com/WadeWegner" target="_blank">twitter feed</a>) the last couple weeks, you’ve probably noticed something about NuGet packages. We’ve been building a lot of Windows Phone and Windows Azure NuGet packages that, when composed together, give you the ability to quickly build some cool applications. To highlight this, here’s a short video that shows how you can enable push notification support in a brand new Windows Phone 7.1 project—and send notifications from a new ASP.NET MVC 3 Web Application running in Windows Azure—in less than two minutes!</p>
<p><iframe style="width: 600px; height: 304px" src="http://channel9.msdn.com/Events/windowsazure/learn/Windows-Phone-Push-Notifications-and-Windows-Azure/player?w=600&amp;h=304" frameborder="0" scrolling="no"></iframe></p>
<p>Here’s a look at how to use the storage NuGet packages to quickly (and securely) upload a picture from the Windows Phone to Windows Azure blob storage.</p>
<p><iframe style="width: 600px; height: 304px" src="http://channel9.msdn.com/Events/windowsazure/learn/Using-Windows-Azure-Storage-on-Windows-Phone/player?w=600&amp;h=304" frameborder="0" scrolling="no"></iframe></p>
<p>All of this is made possible by delivering functional, discrete, and composable NuGet packages. I’ve gotten a lot of feedback (positive and <em>constructive</em>, but fortunately mostly positive) about the <a target="_blank" href="http://watwp.codeplex.com/" target="_blank">Windows Azure Toolkit for Windows Phone</a>, and invariably people have said that it’s too hard to decompose the sample applications – often times people just want Push Notification support or user management, and it’s too hard to get rid of the rest.</p>
<p>I think the NuGet packages make it very easy to do two things:</p>
<ol>
<li>Build brand new applications that quickly can get some advanced capabilities </li>
<li>Quickly update existing applications to get some desirable enhancements </li>
</ol>
<p>This is largely possible because we can easily manage and deliver dependencies through NuGet. Let us handle the hard stuff – you focus on building out cool applications.</p>
<p>In this post I’d like to provide a list and description of the NuGet packages we’ve delivered so far – I imagine I’ll update this post many times to keep it accurate. I don’t plan to show exactly how to use these packages—I’ll save that for many future posts—but instead I want to use this post as a reference and guidepost moving forward.</p>
<p>So, without further ado, I’d like to introduce you to the two kinds of NuGet packages we have today: Client Side NuGet Packages, and Server Side NuGet Packages.</p>
<p><strong><u><font size="3">Client Side NuGet Packages</font></u></strong></p>
<p>The first set of NuGet packages to be aware of are the NuGet packages for Windows Phone, designed to target Windows Phone OS 7.1 project types.</p>
<p><a target="_blank" href="http://images.wadewegner.com/wordpress/2011/11/Windows-Phone-OS-7.1.jpg"><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="Windows Phone OS 7.1" border="0" alt="Windows Phone OS 7.1" src="http://images.wadewegner.com/wordpress/2011/11/Windows-Phone-OS-7.1_thumb.jpg" width="373" height="178" /></a></p>
<p>You can use these NuGets in a number of interesting ways. For example, you can quickly incorporate the <a target="_blank" href="http://www.microsoft.com/windowsazure/features/accesscontrol/" target="_blank">Access Control Service</a> into your phone applications using the following NuGet packages:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Identity.AccessControl" target="_blank">Phone.Identity.AccessControl</a></strong>: Access Control Service Log In control for Windows Phone. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Identity.AccessControl.BasePage" target="_blank">Phone.Identity.AccessControl.BasePage</a></strong>: Base log in page for Windows Phone that uses the Access Control Service Log In control. </li>
</ul>
<p>If you’re not using ACS but instead want simple username/password, you can quickly incorporate membership into your phone applications using the following NuGet packages:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Identity.Membership" target="_blank">Phone.Identity.Membership</a></strong>: Membership Sign In control for Windows Phone. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Identity.Membership.BasePage" target="_blank">Phone.Identity.Membership.BasePage</a></strong>: Base log in and register pages for Windows Phone that use the Membership Log In control </li>
</ul>
<p>To get full support for Push Notifications (including Mango updates like deep linking) you can easily incorporate Push Notifications using the following NuGet packages:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Notifications" target="_blank">Phone.Notifications</a></strong>: Class library for Windows Phone to communicate with the Push Notification Registration Cloud Service. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Notifications.BasePage" target="_blank">Phone.Notifications.BasePage</a></strong>: Base notifications page for Windows Phone to register / unregister with the Push Notification Registration Cloud Service for receiving push notification messages. </li>
</ul>
<p>In scenarios where you’d want to secure your notification services using the Access Control Service, you can use the following packages:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Notifications.AccessControl" target="_blank">Phone.Notifications.AccessControl</a></strong>: This package enables communication with the Push Notification Registration Cloud Service using Windows Azure Access Control Service (ACS) for authentication, by adding a set of base pages to the phone application.       </p>
<p>The dependencies and relationships between these NuGets are as follows:&#160; <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="Phone.Notifications.AccessControl" border="0" alt="Phone.Notifications.AccessControl" src="http://images.wadewegner.com/wordpress/2011/11/Phone.Notifications.AccessControl.png" width="552" height="172" /> </li>
</ul>
<p>In scenarios where you’d want to secure your notification services using traditional membership, you can use the following packages:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Phone.Notifications.Membership" target="_blank">Phone.Notifications.Membership</a></strong>: This package enables communication with the Push Notification Registration Cloud Service using Membership for authentication, by adding a set of base pages to the phone application.       </p>
<p>The dependencies and relationships between these NuGets are as follows:&#160; <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="Phone.Notifications.Membership" border="0" alt="Phone.Notifications.Membership" src="http://images.wadewegner.com/wordpress/2011/11/Phone.Notifications.Membership.png" width="552" height="174" /> </li>
</ul>
<p><strong><u></u></strong></p>
<p><strong><u><font size="3"></font></u></strong></p>
<p><strong>[Updated 1/6/12]</strong></p>
<p>Recently we added a set of client side NuGet packages that can communicate with the Windows Azure storage service – either directly (using the storage account information) or through proxy services running in Windows Azure. Here are the packages for the client:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/Phone.Storage" target="_blank">Phone.Storage</a></strong>: Class library for Windows Phone to communicate with Windows Azure storage services directly (using the storage account information) or through Proxy Cloud Services (using custom authentication mechanisms). </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/Phone.Storage.Sample" target="_blank">Phone.Storage.Sample</a></strong>: Sample application for Windows Phone that shows how to use the Windows Azure Storage Client Library for Windows Phone. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/Phone.Storage.AccessControl" target="_blank">Phone.Storage.AccessControl</a></strong>: This package enables communication with the Windows Azure Storage Proxy Cloud Services using Windows Azure Access Control Service (ACS) for authentication.       <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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.wadewegner.com/wp-content/uploads/2012/01/image6.png" width="602" height="154" /> </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/Phone.Storage.Membership" target="_blank">Phone.Storage.Membership</a></strong>: This package enables communication with the Windows Azure Storage Proxy Cloud Services using Membership for authentication.       <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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.wadewegner.com/wp-content/uploads/2012/01/image7.png" width="622" height="162" /> <!--EndFragment--></li>
</ul>
<p><strong><u><font size="3">Server Side NuGet Packages</font></u></strong></p>
<p>Over the years our team has built a lot of libraries for Windows Azure that we regularly use for samples, demos, hands-on labs, and so forth. We’ve continued to refine these libraries and have started to expose some of them as discrete NuGet packages.&#160; Here are some of them:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Common" target="_blank">WindowsAzure.Common</a></strong>: Class library that provides common helpers tools for Windows Azure. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/Storage.Providers" target="_blank">Storage.Providers</a></strong>: ASP.NET Providers (Membership, Roles, Profile and Session State Store) for Windows Azure Tables. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/MpnsRecipe" target="_blank">MpnsRecipe</a></strong>: Class library to communicate with the Microsoft Push Notification Service (MPNS). </li>
</ul>
<p>If you plan to manage users through ASP.NET membership, we have a NuGet package that will handle everything in your Windows Azure project:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Identity.Membership" target="_blank">WindowsAzure.Identity.Membership</a></strong>: Class library that includes the Membership Authentication Cloud Service. </li>
</ul>
<p>We have a set of WebAPI services that work with the Phone.Notifications NuGet packages for handling the Channel URIs and push notification registration services:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Notifications" target="_blank">WindowsAzure.Notifications</a></strong>: This package contains a class library with the Push Notification Registration Cloud Service, and a WebActivator enabled class with the default configuration. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Notifications.Sql" target="_blank">WindowsAzure.Notifications.Sql</a></strong>: Class library that provides storage in a SQL Azure or SQL Server database for the Push Notification Registration Cloud Service. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Notifications.Client.Sql" target="_blank">WindowsAzure.Notifications.Client.Sql</a></strong>: This package contains a class library with a Table Context to access the Push Notification Registration Cloud Service&#8217;s SQL Server tables where the registered enpoints are stored. This package can be used from a worker role to query registered endpoints and send notifications. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Notifications.Client.AzureTables" target="_blank">WindowsAzure.Notifications.Client.AzureTables</a></strong>: This package contains a class library with a Table Context to access the Push Notification Registration Cloud Service&#8217;s Azure Tables where the registered enpoints are stored. This package can be used from a worker role to query registered endpoints and send notifications. </li>
</ul>
<p>If you plan to use the Phone.Notifications.AccessControl NuGet package and secure the communications channel with ACS, then you can use this NuGet package:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsAzure.Notifications.AccessControl" target="_blank">WindowsAzure.Notifications.AccessControl</a></strong>: This package enables authentication using Windows Azure Access Control Service (ACS) for the Push Notification Registration Cloud Service. You just need to configure a Relying Party Application with Simple Web Token (SWT) in your ACS namespace, and configure its settings accordingly in the Web.config.       </p>
<p>The dependencies and relationships between these NuGets are as follows:&#160;&#160; <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="WindowsAzure.Notifications.AccessControl" border="0" alt="WindowsAzure.Notifications.AccessControl" src="http://www.wadewegner.com/wp-content/uploads/2012/01/image2.png" width="704" height="131" /> </li>
</ul>
<p>If you plan to use the Phone.Notifications.Membership NuGet package and secure the communications channel with membership, then you can use this NuGet package:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/CloudServices.Notifications.Membership" target="_blank">CloudServices.Notifications.Membership</a></strong>: This package enables authentication using the Membership provider for the Push Notification.       </p>
<p>The dependencies and relationships between these NuGets are as follows:&#160;&#160; <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="WindowsAzure.Notifications.Membership" border="0" alt="WindowsAzure.Notifications.Membership" src="http://www.wadewegner.com/wp-content/uploads/2012/01/image3.png" width="704" height="147" /> </li>
</ul>
<p>When working with Push Notifications, you need some kind of client to generate and send notifications. We’ve built some simple scaffolding that you can use during development (or production?) to generate and send notifications:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/List/Packages/WindowsPhone.Notifications.ManagementUI.Sample" target="_blank">WindowsPhone.Notifications.ManagementUI.Sample</a></strong>: A sample MVC Area containing the Management UI for sending Push Notifications to Windows Phone Devices. </li>
</ul>
<p><strong>[Updated 1/6/12]</strong></p>
<p>Recently we added a set of client side NuGet packages that can communicate with the Windows Azure storage service – either directly (using the storage account information) or through proxy services running in Windows Azure. Here are the packages for the services:</p>
<ul>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage" target="_blank">WindowsAzure.Storage</a></strong>: This client library enables working with the Windows Azure storage services which include the blob service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage.Proxy" target="_blank">WindowsAzure.Storage.Proxy</a></strong>: This package contains a class library with the Windows Azure Storage Proxy Cloud Services, and a <i>WebActivator</i> enabled class with the default configuration. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage.AccessControl" target="_blank">WindowsAzure.Storage.AccessControl</a></strong>:This package enables authentication using Windows Azure Access Control Service (ACS) for the Windows Azure Storage Proxy Cloud Services. You just need to configure a Relying Party Application with Simple Web Token (SWT) in your ACS namespace, and configure its settings accordingly in the Web.config. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage.Proxy.AccessControl" target="_blank">WindowsAzure.Storage.Proxy.AccessControl</a></strong>: This package enables authentication using Windows Azure Access Control Service (ACS) for the Windows Azure Storage Proxy Cloud Services. You just need to configure a Relying Party Application with Simple Web Token (SWT) in your ACS namespace, and configure its settings accordingly in the Web.config.       <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 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="WindowsAzure.Storage.AccessControl" border="0" alt="WindowsAzure.Storage.AccessControl" src="http://www.wadewegner.com/wp-content/uploads/2012/01/image4.png" width="602" height="170" /> </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage.Membership" target="_blank">WindowsAzure.Storage.Membership</a></strong>: This package enables authentication using the Membership provider for the Windows Azure Storage Proxy Cloud Services. You just need to make sure to have a valid Membership provider configured in your Web.config. </li>
<li><strong><a target="_blank" href="http://www.nuget.org/packages/WindowsAzure.Storage.Proxy.Membership" target="_blank">WindowsAzure.Storage.Proxy.Membership</a></strong>: This package enables authentication using the Membership provider for the Windows Azure Storage Proxy Cloud Services. You just need to make sure to have a valid Membership provider configured in your Web.config.       <br /><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="WindowsAzure.Storage.Membership" border="0" alt="WindowsAzure.Storage.Membership" src="http://www.wadewegner.com/wp-content/uploads/2012/01/image5.png" width="602" height="217" /> </li>
</ul>
<p>That’s it!</p>
<p>It’s a lot of resources, I know. The intent of this post isn’t to necessarily provide you with the guidance on how to use all these NuGets, but rather to explain what we have available. I plan to write a lot of blog posts that highlight real scenarios and use cases for these NuGet packages, so I’ll refer back to this post quite often. In the meantime, I hope it gives you a&#160; feel for how we’re thinking about engineering and delivering resources for Windows Phone and Windows Azure moving forward.</p>
<p>I hope this helps!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=1GvSmRq6TJU:UPPFInoWziA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=1GvSmRq6TJU:UPPFInoWziA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=1GvSmRq6TJU:UPPFInoWziA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=1GvSmRq6TJU:UPPFInoWziA:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/1GvSmRq6TJU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/nuget-packages-for-windows-azure-and-windows-phone-developers/</feedburner:origLink></item>
		<item>
		<title>Aggregating RSS Feeds in C# and ASP.NET MVC 3</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/RRDQbd0GB9c/</link>
		<comments>http://www.wadewegner.com/2011/11/aggregating-rss-feeds-in-c-and-asp-net-mvc-3/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 19:48:06 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC3]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/11/aggregating-rss-feeds-in-c-and-asp-net-mvc-3/</guid>
		<description><![CDATA[I’m working on a Windows Phone project that requires me to surface up multiple RSS feeds as a single source. I needed a way to do this quickly and easily, and with a little help from friends on Twitter (particularly a suggestion from @bertcraven) I found a nice way to accomplish this using the SyndicationFeed [...]]]></description>
			<content:encoded><![CDATA[
<p>I’m working on a Windows Phone project that requires me to surface up multiple RSS feeds as a single source. I needed a way to do this quickly and easily, and with a little help from friends on Twitter (particularly a suggestion from <a target="_blank" href="http://twitter.com/bertcraven" target="_blank">@bertcraven</a>) I found a nice way to accomplish this using the <font face="Courier New"><strong>SyndicationFeed</strong></font> in <font face="Courier New"><strong>System.ServiceModel.Syndication</strong></font>.</p>
<p>I’ve detailed the steps below, but if you want to get to the heart of it then here’s the code to get this working:</p>
<pre class="code"><span style="color: #2b91af">SyndicationFeed </span>mainFeed = <span style="color: blue">new </span><span style="color: #2b91af">SyndicationFeed</span>();
<span style="color: #2b91af">List</span>&lt;<span style="color: blue">string</span>&gt; feeds = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: blue">string</span>&gt;();
<span style="clear: both">
feeds.Add(<span style="color: #a31515">&quot;http://feeds2.feedburner.com/WadeWegner&quot;</span>);
feeds.Add(<span style="color: #a31515">&quot;http://www.nickharris.net/feed/&quot;</span>);
feeds.Add(<span style="color: #a31515">&quot;http://feeds.feedburner.com/ntotten&quot;</span>);
feeds.Add(<span style="color: #a31515">&quot;http://michaelwasham.com/feed/&quot;</span>);
feeds.Add(<span style="color: #a31515">&quot;http://blogs.msdn.com/b/hpctrekker/rss.aspx&quot;</span>);
<span style="clear: both">
<span style="color: blue">foreach </span>(<span style="color: blue">var </span>feed <span style="color: blue">in </span>GetRssFeeds())
{
    <span style="color: #2b91af">Uri </span>feedUri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(feed);
    <span style="color: #2b91af">SyndicationFeed </span>syndicationFeed;
    <span style="color: blue">using </span>(<span style="color: #2b91af">XmlReader </span>reader = <span style="color: #2b91af">XmlReader</span>.Create(feedUri.AbsoluteUri))
    {
        syndicationFeed = <span style="color: #2b91af">SyndicationFeed</span>.Load(reader);
    }

    syndicationFeed.Id = feed;

    <span style="color: #2b91af">SyndicationFeed </span>tempFeed = <span style="color: blue">new </span><span style="color: #2b91af">SyndicationFeed</span>(
        mainFeed.Items.Union(syndicationFeed.Items).OrderByDescending(u =&gt; u.PublishDate));
    mainFeed = tempFeed;
}</pre>
<p>It’s really quite simple – once you know how to do it!</p>
<p>As you iterate through the list of feeds we use LINQ to union the feeds together – in the end this produces a main feed that has all the contents. Along the way we sort the elements in a descending order based on the <strong><font face="Courier New">PublishDate</font></strong> – otherwise you’ll just get blocks from each of the feeds and nothing is sorted according to the date publish. Once this is done you end up with a main feed that you can use.</p>
<p>For me I wanted to create a service that published the aggregated feed – I chose to use ASP.NET MVC 3 for this new feed. Here are steps you can follow in order to get this working in ASP.NET MVC 3.</p>
<ol>
<li>Create a new ASP.NET MVC 3 Web Application. I’ve called mine <strong>RssFeed</strong>.&#160; <br /><a target="_blank" href="http://images.wadewegner.com/wordpress/2011/11/NewProject.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px 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="NewProject" border="0" alt="NewProject" src="http://images.wadewegner.com/wordpress/2011/11/NewProject_thumb.jpg" width="240" height="166" /></a> </li>
<li>Choose an <strong>Internet Application</strong> using the <strong>Razor</strong> view engine and <strong>HTML5 semantic</strong> markup. </li>
<li>Add <strong><font face="Courier New">System.ServiceModel</font></strong> as a reference in the application. We’ll use this with <strong><font face="Courier New">SyndicationFeed</font></strong>. </li>
<li>Create an empty controller. I’ve called mine the <strong>RssController</strong>.&#160; <br /><a target="_blank" href="http://images.wadewegner.com/wordpress/2011/11/RssFeed.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px 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="RssFeed" border="0" alt="RssFeed" src="http://images.wadewegner.com/wordpress/2011/11/RssFeed_thumb.jpg" width="240" height="169" /></a> </li>
<li>We’re going to define our own <strong><font face="Courier New">ActionResult</font></strong> implementation that can emit RSS by deriving from <font face="Courier New"><strong>ActionResult</strong></font>. Inspiration and original source comes from <a target="_blank" href="http://www.developerzen.com/2009/01/11/aspnet-mvc-rss-feed-action-result/" target="_blank">this post</a> on Developer Zen.
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">RssActionResult </span>: <span style="color: #2b91af">ActionResult
</span>{
    <span style="color: blue">public </span><span style="color: #2b91af">SyndicationFeed </span>Feed { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

    <span style="color: blue">public override void </span>ExecuteResult(<span style="color: #2b91af">ControllerContext </span>context)
    {
        context.HttpContext.Response.ContentType = <span style="color: #a31515">&quot;application/rss+xml&quot;</span>;

        <span style="color: #2b91af">Rss20FeedFormatter </span>rssFormatter = <span style="color: blue">new </span><span style="color: #2b91af">Rss20FeedFormatter</span>(Feed);
        <span style="color: blue">using </span>(<span style="color: #2b91af">XmlWriter </span>writer = <span style="color: #2b91af">XmlWriter</span>.Create(context.HttpContext.Response.Output))
        {
            rssFormatter.WriteTo(writer);
        }
    }
}</pre>
</li>
<li>We can now update the <strong><font face="Courier New">Index</font></strong> method to use the <strong><font face="Courier New">RssActionResult</font></strong> instead of the default <strong><font face="Courier New">ActionResult</font></strong> implementation.
<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">RssActionResult </span>Index()
{
    <span style="color: blue">return new </span><span style="color: #2b91af">RssActionResult</span>();
}</pre>
</li>
<li>Define a method that returns all the feeds with which you want to aggregate. You can pull from many different places – I recommend SQL Azure – but for the purposes of this demo you can just use a generic list of strings.
<pre class="code"><span style="color: blue">private static </span><span style="color: #2b91af">List</span>&lt;<span style="color: blue">string</span>&gt; GetRssFeeds()
{
    <span style="color: #2b91af">List</span>&lt;<span style="color: blue">string</span>&gt; feeds = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: blue">string</span>&gt;();

    feeds.Add(<span style="color: #a31515">&quot;http://feeds2.feedburner.com/WadeWegner&quot;</span>);
    feeds.Add(<span style="color: #a31515">&quot;http://www.nickharris.net/feed/&quot;</span>);
    feeds.Add(<span style="color: #a31515">&quot;http://feeds.feedburner.com/ntotten&quot;</span>);

    <span style="color: blue">return </span>feeds;
}</pre>
</li>
<li>Now we can update our Index method to iterate through the feeds and aggregate them into a single SyndicationFeed that is sorted (descending) by the publish date.
<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">RssActionResult </span>Index()
{
    <span style="color: #2b91af">SyndicationFeed </span>mainFeed = <span style="color: blue">new </span><span style="color: #2b91af">SyndicationFeed</span>();

    <span style="color: blue">foreach </span>(<span style="color: blue">var </span>feed <span style="color: blue">in </span>GetRssFeeds())
    {
        <span style="color: #2b91af">Uri </span>feedUri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(feed);
        <span style="color: #2b91af">SyndicationFeed </span>syndicationFeed;
        <span style="color: blue">using </span>(<span style="color: #2b91af">XmlReader </span>reader = <span style="color: #2b91af">XmlReader</span>.Create(feedUri.AbsoluteUri))
        {
            syndicationFeed = <span style="color: #2b91af">SyndicationFeed</span>.Load(reader);
        }

        syndicationFeed.Id = feed;

        <span style="color: #2b91af">SyndicationFeed </span>tempFeed = <span style="color: blue">new </span><span style="color: #2b91af">SyndicationFeed</span>(
            mainFeed.Items.Union(syndicationFeed.Items).OrderByDescending(u =&gt; u.PublishDate));
        mainFeed = tempFeed;
    }

    <span style="color: blue">return new </span><span style="color: #2b91af">RssActionResult</span>() { Feed = mainFeed };
}</pre>
</li>
<li>Now, hit F5 and run. Browse to http://localhost:&lt;port&gt;/rss to see the aggregated RSS feed.&#160; <br /><a target="_blank" href="http://images.wadewegner.com/wordpress/2011/11/RssFeed.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px 0px 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="RssFeed" border="0" alt="RssFeed" src="http://images.wadewegner.com/wordpress/2011/11/RssFeed_thumb.jpg" width="640" height="451" /></a> </li>
</ol>
<p>And that’s it!</p>
<p>There’s certainly more you can do with this – in fact, given the cost it takes to aggregate a large number of feeds, I’ve started to take the aggregated feed and store it in Windows Azure blob storage attached to the Content Delivery Network (CDN). The code to do this is similar to the following:</p>
<pre class="code"><span style="color: #2b91af">StringBuilder </span>builder = <span style="color: blue">new </span><span style="color: #2b91af">StringBuilder</span>();
<span style="color: blue">using </span>(<span style="color: #2b91af">XmlWriter </span>writer = <span style="color: #2b91af">XmlWriter</span>.Create(builder))
{
    mainFeed.SaveAsRss20(writer);
    <span style="color: blue">string </span>rssFeed = builder.ToString();

</span>}
<span style="color: green">// write to Windows Azure blob storage</span></pre>
<pre class="code"><font face="Calibri">You might consider doing something similar.</font></pre>
<pre class="code"><font face="Calibri">I hope this helps!</font></pre>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=RRDQbd0GB9c:GfxdK0UcxNQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=RRDQbd0GB9c:GfxdK0UcxNQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=RRDQbd0GB9c:GfxdK0UcxNQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=RRDQbd0GB9c:GfxdK0UcxNQ:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/RRDQbd0GB9c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/11/aggregating-rss-feeds-in-c-and-asp-net-mvc-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/11/aggregating-rss-feeds-in-c-and-asp-net-mvc-3/</feedburner:origLink></item>
		<item>
		<title>Windows Azure Platform Training Kit – October Release</title>
		<link>http://feedproxy.google.com/~r/WadeWegner/~3/jTxYMtPZBes/</link>
		<comments>http://www.wadewegner.com/2011/10/windows-azure-platform-training-kit-october-release/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 21:42:11 +0000</pubDate>
		<dc:creator>Wade</dc:creator>
				<category><![CDATA[HPC]]></category>
		<category><![CDATA[SQL Azure]]></category>
		<category><![CDATA[Training Course]]></category>
		<category><![CDATA[Training Kit]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Azure Platform]]></category>

		<guid isPermaLink="false">http://www.wadewegner.com/2011/10/windows-azure-platform-training-kit-october-release/</guid>
		<description><![CDATA[Today we published the Windows Azure Platform Training Kit &#8211; October Release. The Windows Azure Platform Training Kit includes hands-on labs, presentations, and samples to help you understand how to build applications that utilize Windows Azure, SQL Azure, and the Windows Azure AppFabric. Download Now: You can download the full training kit including the hands-on [...]]]></description>
			<content:encoded><![CDATA[
<p>Today we published the <strong>Windows Azure Platform Training Kit &#8211; October Release</strong>. The Windows Azure Platform Training Kit includes hands-on labs, presentations, and samples to help you understand how to build applications that utilize Windows Azure, SQL Azure, and the Windows Azure AppFabric.</p>
<ul>
<li><strong>Download Now</strong>: You can download the full training kit including the hands-on labs, demo scripts, and presentations from the Microsoft download center here: <a target="_blank" title="Windows Azure Platform Training Kit" href="http://go.microsoft.com/fwlink/?LinkID=130354" target="_blank">http://go.microsoft.com/fwlink/?LinkID=130354</a>.</li>
<li><strong>Browse the hands-on labs</strong>: Alternatively, you can browse through the individual hands-on labs on the MSDN site here: <a target="_blank" href="http://bit.ly/WAPCourse">http://bit.ly/WAPCourse</a></li>
</ul>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WAPTK" border="0" alt="WAPTK" src="http://images.wadewegner.com/wordpress/2011/10/WAPTK.jpg" width="582" height="480" /></p>
<p>The October 2011 update of the training kit includes the following updates: </p>
<ul>
<li><strong>[New Hands-On Lab]</strong> SQL Azure Data-tier Applications </li>
<li><strong>[New Hands-On Lab]</strong> SQL Azure Data Sync </li>
<li><strong>[New Hands-On Lab]</strong> SQL Azure Federations </li>
<li><strong>[New Demo]</strong> Provisioning Logical Servers using Cmdlets Demo </li>
<li><strong>[New Demo]</strong> Parallel Computing on Azure &#8211; Travelling Salesman Demo </li>
<li><strong>[Updated]</strong> SQL Azure Labs and Demos with the new portal and tooling experience </li>
<li>Applied several minor fixes in content</li>
</ul>
<p>As with the September release, we have shipped an (updated) preview of our web installer. The training kit web installer is a very small application weighing in at 2MB. The web installer enables you to select and download just the hands-on labs, demos, and presentations that you want instead of downloading the entire training kit. As new or updated hands-on labs, presentations, and demos are available they will automatically show up in the web installer – so you won’t have to download it again.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WebInstallerPreview2" border="0" alt="WebInstallerPreview2" src="http://images.wadewegner.com/wordpress/2011/10/WebInstallerPreview2.jpg" width="582" height="437" /></p>
<p>You can now download the training kit web installer preview release from <a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=130354">here</a>. </p>
<p>We really try to make these training resources valuable to you, so please be sure to provide feedback if you find a bug, mistake, or feel as if we should including something else in the kit.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=jTxYMtPZBes:5yC0UbpEu88:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=jTxYMtPZBes:5yC0UbpEu88:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/WadeWegner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/WadeWegner?a=jTxYMtPZBes:5yC0UbpEu88:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/WadeWegner?i=jTxYMtPZBes:5yC0UbpEu88:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/WadeWegner/~4/jTxYMtPZBes" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.wadewegner.com/2011/10/windows-azure-platform-training-kit-october-release/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.wadewegner.com/2011/10/windows-azure-platform-training-kit-october-release/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.528 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-09 08:10:19 --><!-- Compression = gzip -->

