<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>.NET Meanderings - REST</title>
    <link>http://www.dotnetconsult.co.uk/weblog2/</link>
    <description>Richard Blewett's wanderings around .NET</description>
    <language>en-us</language>
    <copyright>Richard Blewett</copyright>
    <lastBuildDate>Wed, 15 Jun 2011 09:21:33 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.6264.0</generator>
    <managingEditor>richard@dotnetconsult.co.uk</managingEditor>
    <webMaster>richard@dotnetconsult.co.uk</webMaster>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=d69307a4-76c2-4a38-b317-1c15fb189acc</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,d69307a4-76c2-4a38-b317-1c15fb189acc.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just a heads up that when self hosting the new WCF Web API. By default if you try
to add the Web API references via Nuget you will get a failure (E_FAIL returned from
a COM component).
</p>
        <p>
This is due to the likely project types (Console, Windows Service, WPF) defaulting
to the client profile rather than the full framework. If you change the project to
the full framework the Nuget packages install correctly
</p>
        <p>
Yet again bitten by the Client Profile 
</p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=d69307a4-76c2-4a38-b317-1c15fb189acc" />
      </body>
      <title>Self Hosted Web API / Nuget Gotcha</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,d69307a4-76c2-4a38-b317-1c15fb189acc.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,d69307a4-76c2-4a38-b317-1c15fb189acc.aspx</link>
      <pubDate>Wed, 15 Jun 2011 09:21:33 GMT</pubDate>
      <description>&lt;p&gt;
Just a heads up that when self hosting the new WCF Web API. By default if you try
to add the Web API references via Nuget you will get a failure (E_FAIL returned from
a COM component).
&lt;/p&gt;
&lt;p&gt;
This is due to the likely project types (Console, Windows Service, WPF) defaulting
to the client profile rather than the full framework. If you change the project to
the full framework the Nuget packages install correctly
&lt;/p&gt;
&lt;p&gt;
Yet again bitten by the Client Profile 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=d69307a4-76c2-4a38-b317-1c15fb189acc" /&gt;</description>
      <category>.NET;REST;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=51443278-6c7c-4eba-8335-075d97b9f66d</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,51443278-6c7c-4eba-8335-075d97b9f66d.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just got back from speaking at <a href="http://www.software-architect.co.uk/">Software
Architect 2009</a>. I had a great time at the conference and thanks to everyone who
attended my sessions. As promised the slides and demos are now available on the <a href="http://rocksolidknowledge.com">Rock
Solid Knowledge</a> website and you can get them from the <a href="http://rocksolidknowledge.com/Conferences.mvc/">Conferences</a> page.
</p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=51443278-6c7c-4eba-8335-075d97b9f66d" />
      </body>
      <title>Slides and Demos from Software Architect 2009 are now available</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,51443278-6c7c-4eba-8335-075d97b9f66d.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,51443278-6c7c-4eba-8335-075d97b9f66d.aspx</link>
      <pubDate>Fri, 02 Oct 2009 21:12:18 GMT</pubDate>
      <description>&lt;p&gt;
I just got back from speaking at &lt;a href="http://www.software-architect.co.uk/"&gt;Software
Architect 2009&lt;/a&gt;. I had a great time at the conference and thanks to everyone who
attended my sessions. As promised the slides and demos are now available on the &lt;a href="http://rocksolidknowledge.com"&gt;Rock
Solid Knowledge&lt;/a&gt; website and you can get them from the &lt;a href="http://rocksolidknowledge.com/Conferences.mvc/"&gt;Conferences&lt;/a&gt; page.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=51443278-6c7c-4eba-8335-075d97b9f66d" /&gt;</description>
      <category>.NET;Azure;REST;RSK;WCF;WF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=2ce96651-c153-416a-a680-cced6ee34fdd</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,2ce96651-c153-416a-a680-cced6ee34fdd.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been doing some work with the <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24644">WCF
REST Starter Kit</a> for our website <a href="http://rocksolidknowledge.com">http://rocksolidknowledge.com</a>.
Preview 2 of the start kit has a bunch of client side plumbing (the original release
concentrated on the service side)
</p>
        <p>
The client side code looks something like this:
</p>
        <p>
          <font size="2">
            <font face="Courier New">
              <font color="#2b91af">
                <font color="#2b91af">HttpClient</font>
              </font> client
= <font color="#0000ff"><font color="#0000ff">new</font></font><font color="#2b91af"><font color="#2b91af">HttpClient</font></font>(<font color="#a31515"><font color="#a31515">"http://twitter.com"</font></font>);</font>
          </font>
        </p>
        <p>
          <font size="2">
            <font face="Courier New">
              <font color="#2b91af">
                <font color="#2b91af">HttpResponseMessage</font>
              </font> response
= client.Get(<font color="#a31515"><font color="#a31515">"statuses/user_timeline/richardblewett.xml"</font></font>);</font>
          </font>
        </p>
        <p>
          <font size="2">
            <font face="Courier New">
              <font color="#2b91af">
                <font color="#2b91af">Console</font>
              </font>.WriteLine(response.Content.ReadAsString());</font>
          </font>
        </p>
        <p>
          <font size="2">As compact as this is I was a bit disappointed to see that I only had
a few options for processing the content: <font face="Courier New">ReadAsString</font>, <font face="Courier New">ReadAsStream</font> and <font face="Courier New">ReadAsByteArray</font>.
Now seeing as they had a free hand to give you all sorts of processing options I was
surprised there weren’t more. However, one of the assemblies with the start kit is
called <font face="Courier New">Microsoft.Http.Extensions</font>. So I opened it up
in <a href="http://www.red-gate.com/products/reflector/">Reflector</a> and lo and
behold there are a whole bunch of extension methods in there – so why wasn’t I seeing
them? </font>
        </p>
        <p>
          <font size="2">Extension methods become available to your code when their namespace
is in scope (e.g. when you have a using statement for the namespace in your code).
It turns out that the team put the extension methods in the namespaces appropriate
to the technology they were exposing. So for example the <font face="Courier New">ReadAsXElement</font> extension
method is in the <font face="Courier New">System.Xml.Linq</font> namespace and the <font face="Courier New">ReadAsXmlSerializable&lt;T&gt;</font> method
is in the <font face="Courier New">System.Xml.Serialization</font> namespace.</font>
        </p>
        <p>
          <font size="2">Although I really like the functionality of the WCF Starter Kit, this
particular practice, to me, seems bizarre. Firstly, it makes the API counter intuitive
– you use the HttpClient class and then there is no hint in the library that there
are a bunch of hidden extensions. Secondly, injecting your extensions into someone
else’s namespace increases the likelihood of extension method collision (where two
libraries define the same extension method in the same namespace). The same named
extension method in difference namespaces can be disambiguated, the same named extension
in the same namespace gives you no chance.</font>
        </p>
        <p>
          <font size="2">I think if you want to define extension methods then you should keep
them in your own namespace – it makes everyone’s life simpler in the long run.</font>
        </p>
        <p>
          <font size="2">
          </font>
        </p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=2ce96651-c153-416a-a680-cced6ee34fdd" />
      </body>
      <title>Extension Methods and Good Practice &amp;ndash; or OI! Get Out of my Namespace!</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,2ce96651-c153-416a-a680-cced6ee34fdd.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,2ce96651-c153-416a-a680-cced6ee34fdd.aspx</link>
      <pubDate>Sun, 05 Apr 2009 15:58:48 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been doing some work with the &lt;a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24644"&gt;WCF
REST Starter Kit&lt;/a&gt; for our website &lt;a href="http://rocksolidknowledge.com"&gt;http://rocksolidknowledge.com&lt;/a&gt;.
Preview 2 of the start kit has a bunch of client side plumbing (the original release
concentrated on the service side)
&lt;/p&gt;
&lt;p&gt;
The client side code looks something like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;&lt;font color="#2b91af"&gt;HttpClient&lt;/font&gt;&lt;/font&gt; client
= &lt;font color="#0000ff"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/font&gt; &lt;font color="#2b91af"&gt;&lt;font color="#2b91af"&gt;HttpClient&lt;/font&gt;&lt;/font&gt;(&lt;font color="#a31515"&gt;&lt;font color="#a31515"&gt;"http://twitter.com"&lt;/font&gt;&lt;/font&gt;);&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;&lt;font color="#2b91af"&gt;HttpResponseMessage&lt;/font&gt;&lt;/font&gt; response
= client.Get(&lt;font color="#a31515"&gt;&lt;font color="#a31515"&gt;"statuses/user_timeline/richardblewett.xml"&lt;/font&gt;&lt;/font&gt;);&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;&lt;font color="#2b91af"&gt;Console&lt;/font&gt;&lt;/font&gt;.WriteLine(response.Content.ReadAsString());&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;As compact as this is I was a bit disappointed to see that I only had
a few options for processing the content: &lt;font face="Courier New"&gt;ReadAsString&lt;/font&gt;, &lt;font face="Courier New"&gt;ReadAsStream&lt;/font&gt; and &lt;font face="Courier New"&gt;ReadAsByteArray&lt;/font&gt;.
Now seeing as they had a free hand to give you all sorts of processing options I was
surprised there weren’t more. However, one of the assemblies with the start kit is
called &lt;font face="Courier New"&gt;Microsoft.Http.Extensions&lt;/font&gt;. So I opened it up
in &lt;a href="http://www.red-gate.com/products/reflector/"&gt;Reflector&lt;/a&gt; and lo and
behold there are a whole bunch of extension methods in there – so why wasn’t I seeing
them? &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Extension methods become available to your code when their namespace
is in scope (e.g. when you have a using statement for the namespace in your code).
It turns out that the team put the extension methods in the namespaces appropriate
to the technology they were exposing. So for example the &lt;font face="Courier New"&gt;ReadAsXElement&lt;/font&gt; extension
method is in the &lt;font face="Courier New"&gt;System.Xml.Linq&lt;/font&gt; namespace and the &lt;font face="Courier New"&gt;ReadAsXmlSerializable&amp;lt;T&amp;gt;&lt;/font&gt; method
is in the &lt;font face="Courier New"&gt;System.Xml.Serialization&lt;/font&gt; namespace.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;Although I really like the functionality of the WCF Starter Kit, this
particular practice, to me, seems bizarre. Firstly, it makes the API counter intuitive
– you use the HttpClient class and then there is no hint in the library that there
are a bunch of hidden extensions. Secondly, injecting your extensions into someone
else’s namespace increases the likelihood of extension method collision (where two
libraries define the same extension method in the same namespace). The same named
extension method in difference namespaces can be disambiguated, the same named extension
in the same namespace gives you no chance.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;I think if you want to define extension methods then you should keep
them in your own namespace – it makes everyone’s life simpler in the long run.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=2ce96651-c153-416a-a680-cced6ee34fdd" /&gt;</description>
      <category>.NET;REST;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=b77d9155-1ad4-43da-ae07-54cc72f32918</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b77d9155-1ad4-43da-ae07-54cc72f32918.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've uploaded an updated version of the BlobExplorer (first blogged about <a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx">here</a>).
It now uses a decent algorithm for determining MIME type (thanks <a href="http://blogs.thinktecture.com/cweyer/">Christian</a>)
and the blob list now retains a single entry when you update an existing blob
</p>
        <p>
Downloadable from my website here
</p>
        <p>
          <a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer12.zip">BlobExplorer12.zip
(55.28 KB)</a>
        </p>
        <p>
downloadable from Azure Blob Storage <a href="http://dotnetconsult.blob.core.windows.net/tools/BlobExplorer.zip">here</a></p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=b77d9155-1ad4-43da-ae07-54cc72f32918" />
      </body>
      <title>Couple of fixes to BlobExplorer</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b77d9155-1ad4-43da-ae07-54cc72f32918.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b77d9155-1ad4-43da-ae07-54cc72f32918.aspx</link>
      <pubDate>Mon, 08 Dec 2008 09:33:00 GMT</pubDate>
      <description>&lt;p&gt;
I've uploaded an updated version of the BlobExplorer (first blogged about &lt;a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx"&gt;here&lt;/a&gt;).
It now uses a decent algorithm for determining MIME type (thanks &lt;a href="http://blogs.thinktecture.com/cweyer/"&gt;Christian&lt;/a&gt;)
and the blob list now retains a single entry when you update an existing blob
&lt;/p&gt;
&lt;p&gt;
Downloadable from my website here
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer12.zip"&gt;BlobExplorer12.zip
(55.28 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
downloadable from Azure Blob Storage &lt;a href="http://dotnetconsult.blob.core.windows.net/tools/BlobExplorer.zip"&gt;here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=b77d9155-1ad4-43da-ae07-54cc72f32918" /&gt;</description>
      <category>.NET;Azure;BlobExplorer;REST;WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=c24f8177-f6bf-479b-bd5c-d532e0e40272</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,c24f8177-f6bf-479b-bd5c-d532e0e40272.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The <a href="http://www.azure.com">Windows Azure</a> Storage infrastructure has three
types of storage:
</p>
        <ul>
          <li>
Blob - for storing arbitrary state as a blob (I <a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx">recently
blogged</a> about writing an explorer for blob storage) 
</li>
          <li>
Table - for storage structured or semi-structured data with the ability to query it 
</li>
          <li>
Queue - primarily for communication between components in the cloud</li>
        </ul>
        <p>
This post is going to concentrate on queue storage as its usage model is a bit different
traditional queuing products such as MSMQ. The code samples in this post use the StorageClient
library sample shipped in the Windows Azure SDK.
</p>
        <p>
Lets start with the basics: you authenticate with Azure storage using your account
name and key provided by the Azure portal when you create a storage project. If you're
using the SDK's deveopment storage the account name, key and uri are fixed. Here
is the code to set up authentication details with development queue storage:
</p>
        <font color="#0000ff" size="4">
          <font color="#0000ff" size="4">
          </font>
        </font>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#0000ff" size="4">
              <font color="#0000ff" size="4">
                <p>
                  <font size="2">string</font>
                </p>
              </font>
            </font>
            <font size="2">
              <font color="#000000"> accountName = </font>
              <font color="#a31515">
                <font color="#a31515">"devstoreaccount1"</font>
              </font>
            </font>
            <font size="2">
              <font color="#000000">;<br /></font>
              <font color="#0000ff">
                <font color="#0000ff">string</font>
              </font>
              <font color="#000000">accountKey</font> = <font color="#a31515"><font color="#a31515">"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="</font></font>;<br /><font color="#0000ff"><font color="#0000ff">string</font></font><font color="#000000">address</font> = <font color="#a31515"><font color="#a31515">"http://127.0.0.1:10001"</font></font>;</font>
            <p>
              <font size="2">
                <font color="#2b91af">
                  <font color="#2b91af">StorageAccountInfo</font>
                </font>
                <font color="#000000">info</font> = <font color="#0000ff"><font color="#0000ff">new</font></font><font color="#2b91af"><font color="#2b91af">StorageAccountInfo</font></font>(<font color="#0000ff"><font color="#0000ff">new</font></font><font color="#2b91af"><font color="#2b91af">Uri</font></font>(<font color="#000000">address</font>), <font color="#0000ff"><font color="#0000ff">null</font></font>, <font color="#000000">accountName</font>, <font color="#000000">accountKey</font>);</font>
            </p>
            <p>
              <font size="2">
                <font color="#2b91af">
                  <font color="#2b91af">QueueStorage</font>
                </font> qs
= <font color="#2b91af"><font color="#2b91af">QueueStorage</font></font>.<font color="#000000">Create(info)</font>;</font>
            </p>
          </span>
        </span>
        <p>
Queues are named within the storage so to create a queue (or address an existing queue)
you use the collowing code:
</p>
        <font size="4">
          <font color="#7fffd4">
            <font color="#2b91af" size="4">
              <font color="#2b91af" size="4">
                <p>
                  <font face="Courier New" size="2">MessageQueue </font>
                </p>
              </font>
            </font>
          </font>
        </font>
        <font face="Courier New" size="2">mq = qs.GetQueue(<font color="#a31515"><font color="#a31515">"fooq"</font></font>);</font>
        <p>
          <font face="Courier New">mq.CreateQueue();</font>
        </p>
        <p>
The <font face="Courier New">CreateQueue</font> method will not recreate an already
existing queue and has an overload to tell you that the queue already existed. You
can then create message objects and push them into the queue as follows:
</p>
        <font size="4">
          <font color="#2b91af" size="4">
            <font color="#2b91af" size="4">
              <p>
                <font face="Courier New" size="2">Message </font>
              </p>
            </font>
          </font>
        </font>
        <font size="2">
          <font face="Courier New">msg = </font>
          <font face="Courier New">
            <font color="#0000ff">
              <font color="#0000ff">new</font>
            </font>
            <font color="#2b91af">
              <font color="#2b91af">Message</font>
            </font>(<font color="#2b91af"><font color="#2b91af">DateTime</font></font></font>
          <font face="Courier New">.Now.ToString());</font>
        </font>
        <p>
          <font face="Courier New">mq.PutMessage(msg);</font>
        </p>
        <p>
Hopefully none of this so far is particularly shocking. Where things start to get
interesting is on the receive side. We can simply receive a message so:
</p>
        <font size="4">
          <p>
          </p>
        </font>
        <font size="2">
          <font face="Courier New">msg = mq.GetMessage(5);<br /></font>
          <font face="Courier New">
            <font color="#0000ff">
              <font color="#0000ff">if</font>
            </font> (msg
!= <font color="#0000ff"><font color="#0000ff">null</font></font></font>
        </font>
        <font face="Courier New">)<br />
{<br />
    <font color="#2b91af"><font color="#2b91af">Console</font></font></font>
        <font face="Courier New">.WriteLine(msg.ContentAsString());<br />
}</font>
        <p>
So what is interesting about this? Firstly notice that the <font face="Courier New">GetMessage</font> takes
a parameter - this is a timeout in seconds. Secondly, <font face="Courier New">GetMessage</font> doesn't
block but will return null if there is no message to receive. Finally, although you
can't see it from the above code, the message is still on the queue. To remove the
message you need to delete it:
</p>
        <font size="4">
          <font color="#2b91af" size="4">
            <font color="#2b91af" size="4">
              <p>
                <font face="Courier New" size="2">Message </font>
              </p>
            </font>
          </font>
        </font>
        <font size="2">
          <font face="Courier New">msg = mq.GetMessage(5);<br /></font>
          <font face="Courier New">
            <font color="#0000ff">
              <font color="#0000ff">if</font>
            </font> (msg
!= <font color="#0000ff"><font color="#0000ff">null</font></font></font>
        </font>
        <font face="Courier New">)<br />
{<br />
    <font color="#2b91af"><font color="#2b91af">Console</font></font></font>
        <font face="Courier New">.WriteLine(msg.ContentAsString());<br />
    mq.DeleteMessage(msg);<br />
}</font>
        <p>
This is where that timeout comes in: having received a message, that message is locked
for the specified timeout. You must called <font face="Courier New">DeleteMessage</font> within
that timeout otherwise the message is unlocked and can be picked up by another queue
reader. This prevents a queue reader trying to process a message and then dying leaving
the message locked. It, in effect, provides a loose form of transaction around the
queue without having to formally support transactional sematics which tend not to
scale at web levels.
</p>
        <p>
However, currently we have to code some polling logic as the <font face="Courier New">GetMessage</font> call
doesn't block. The <font face="Courier New">MessageQueue</font> class in StorageClient
also provides the polling infrastructure under the covers and delivers the message
via eventing:
</p>
        <font size="4">
          <font size="4">
            <p>
            </p>
          </font>
          <font face="Courier New" size="2">mq.MessageReceived += <font color="#0000ff"><font color="#0000ff">new</font></font><font color="#2b91af"><font color="#2b91af">MessageReceivedEventHandler</font></font>(mq_MessageReceived);<br />
mq.PollInterval = 2000; <font color="#008000">// in milliseconds</font><br />
mq.StartReceiving(); <font color="#008000">// start polling</font></font>
          <p>
            <font size="4">
              <font color="#000000" size="2">The event handler will fire every time
a message is received and when there are no more messages the client will start polling
the queue according to the <font face="Courier New">PollInterval</font></font>
            </font>
          </p>
          <p>
            <font size="4">
              <font color="#000000" size="2">Bear in mind that the same semantics
apply to receiving messages. It is beholden on the receiver to delete the message
within the timeout otherwise the message will again become visible to other readers.
Notice here we don't explicitly set a timeout and so a default is picked up from the <font face="Courier New">Timeout</font> property
on the <font face="Courier New">MessageQueue</font> class (this defaults to 30 seconds).</font>
            </font>
          </p>
          <p>
            <font size="4">
              <font color="#000000" size="2">Using the code above it is very easy
to think that everything is running with a nicely tuned .NET API under the covers.
Remember, however, that this infrastructure is actually exposed via internet
standard protocols. All we have here in reality is a convenient wrapper over the storage
REST API. And so bear in mind that the event model is just a convenience provided
by the class library and not an inherent feature built into queue storage. Similarly
the reason that <font face="Courier New">GetMessage</font> doesn't block is simply
that it wraps an HTTP request that returns an empty queue message list if there are
no messages on the queue. If you use <font face="Courier New">GetMessage</font> or
eventing API then the messages are retrieved one at a time. You can also use the <font face="Courier New">GetMessages</font> API
which will allows you to receive multiple messages at once. </font>
            </font>
          </p>
        </font>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=c24f8177-f6bf-479b-bd5c-d532e0e40272" />
      </body>
      <title>Using Azure Queue Storage</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,c24f8177-f6bf-479b-bd5c-d532e0e40272.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,c24f8177-f6bf-479b-bd5c-d532e0e40272.aspx</link>
      <pubDate>Sun, 07 Dec 2008 11:04:49 GMT</pubDate>
      <description>&lt;p&gt;
The &lt;a href="http://www.azure.com"&gt;Windows Azure&lt;/a&gt; Storage infrastructure has three
types of storage:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Blob - for storing arbitrary state as a blob (I &lt;a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx"&gt;recently
blogged&lt;/a&gt; about writing an explorer for blob storage) 
&lt;li&gt;
Table - for storage structured or semi-structured data with the ability to query it 
&lt;li&gt;
Queue - primarily for communication between components in the cloud&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This post is going to concentrate on queue storage as its usage model is a bit different
traditional queuing products such as MSMQ. The code samples in this post use the StorageClient
library sample shipped in the Windows Azure SDK.
&lt;/p&gt;
&lt;p&gt;
Lets start with the basics: you authenticate with Azure storage using your account
name and key provided by the Azure portal when you create a storage project. If you're
using&amp;nbsp;the SDK's deveopment storage the account name, key and uri are fixed. Here
is the code to set up authentication details&amp;nbsp;with development queue storage:
&lt;/p&gt;
&lt;font color=#0000ff size=4&gt;&lt;font color=#0000ff size=4&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font color=#0000ff size=4&gt;&lt;font color=#0000ff size=4&gt; 
&lt;p&gt;
&lt;font size=2&gt;string&lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; accountName = &lt;/font&gt;&lt;font color=#a31515&gt;&lt;font color=#a31515&gt;"devstoreaccount1"&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;string&lt;/font&gt;&lt;/font&gt; &lt;font color=#000000&gt;accountKey&lt;/font&gt; = &lt;font color=#a31515&gt;&lt;font color=#a31515&gt;"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="&lt;/font&gt;&lt;/font&gt;;&lt;br&gt;
&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;string&lt;/font&gt;&lt;/font&gt; &lt;font color=#000000&gt;address&lt;/font&gt; = &lt;font color=#a31515&gt;&lt;font color=#a31515&gt;"http://127.0.0.1:10001"&lt;/font&gt;&lt;/font&gt;;&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font size=2&gt;&lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;StorageAccountInfo&lt;/font&gt;&lt;/font&gt; &lt;font color=#000000&gt;info&lt;/font&gt; = &lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;new&lt;/font&gt;&lt;/font&gt; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;StorageAccountInfo&lt;/font&gt;&lt;/font&gt;(&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;new&lt;/font&gt;&lt;/font&gt; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;Uri&lt;/font&gt;&lt;/font&gt;(&lt;font color=#000000&gt;address&lt;/font&gt;), &lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;null&lt;/font&gt;&lt;/font&gt;, &lt;font color=#000000&gt;accountName&lt;/font&gt;, &lt;font color=#000000&gt;accountKey&lt;/font&gt;);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=2&gt;&lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;QueueStorage&lt;/font&gt;&lt;/font&gt; qs
= &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;QueueStorage&lt;/font&gt;&lt;/font&gt;.&lt;font color=#000000&gt;Create(info)&lt;/font&gt;;&lt;/font&gt;
&lt;/p&gt;
&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
Queues are named within the storage so to create a queue (or address an existing queue)
you use the collowing code:
&lt;/p&gt;
&lt;font size=4&gt;&lt;font color=#7fffd4&gt;&lt;font color=#2b91af size=4&gt;&lt;font color=#2b91af size=4&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;MessageQueue &lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size=2&gt;mq = qs.GetQueue(&lt;font color=#a31515&gt;&lt;font color=#a31515&gt;"fooq"&lt;/font&gt;&lt;/font&gt;);&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;mq.CreateQueue();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The &lt;font face="Courier New"&gt;CreateQueue&lt;/font&gt; method will not recreate an already
existing queue and has an overload to tell you that the queue already existed. You
can then create message objects and push them into the queue as follows:
&lt;/p&gt;
&lt;font size=4&gt;&lt;font color=#2b91af size=4&gt;&lt;font color=#2b91af size=4&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;Message &lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font face="Courier New"&gt;msg = &lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;new&lt;/font&gt;&lt;/font&gt; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;Message&lt;/font&gt;&lt;/font&gt;(&lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;DateTime&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;.Now.ToString());&lt;/font&gt;&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;mq.PutMessage(msg);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Hopefully none of this so far is particularly shocking. Where things start to get
interesting is on the receive side. We can simply receive a message so:
&lt;/p&gt;
&lt;font size=4&gt; 
&lt;p&gt;
&lt;/font&gt;&lt;font size=2&gt;&lt;font face="Courier New"&gt;msg = mq.GetMessage(5);&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;if&lt;/font&gt;&lt;/font&gt; (msg
!= &lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;null&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;Console&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;.WriteLine(msg.ContentAsString());&lt;br&gt;
}&lt;/font&gt;&gt;
&lt;p&gt;
So what is interesting about this? Firstly notice that the &lt;font face="Courier New"&gt;GetMessage&lt;/font&gt; takes
a parameter - this is a timeout in seconds. Secondly, &lt;font face="Courier New"&gt;GetMessage&lt;/font&gt; doesn't
block but will return null if there is no message to receive. Finally, although you
can't see it from the above code, the message is still on the queue. To remove the
message you need to delete it:
&lt;/p&gt;
&lt;font size=4&gt;&lt;font color=#2b91af size=4&gt;&lt;font color=#2b91af size=4&gt; 
&lt;p&gt;
&lt;font face="Courier New" size=2&gt;Message &lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font face="Courier New"&gt;msg = mq.GetMessage(5);&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;if&lt;/font&gt;&lt;/font&gt; (msg
!= &lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;null&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;Console&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;.WriteLine(msg.ContentAsString());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; mq.DeleteMessage(msg);&lt;br&gt;
}&lt;/font&gt;&gt;
&lt;p&gt;
This is where that timeout comes in: having received a message, that message is locked
for the specified timeout. You must called &lt;font face="Courier New"&gt;DeleteMessage&lt;/font&gt; within
that timeout otherwise the message is unlocked and can be picked up by another queue
reader. This prevents a queue reader trying to process a message and then dying leaving
the message locked. It, in effect, provides a loose form of transaction around the
queue without having to formally support transactional sematics which tend not to
scale at web levels.
&lt;/p&gt;
&lt;p&gt;
However, currently we have to code some polling logic as the &lt;font face="Courier New"&gt;GetMessage&lt;/font&gt; call
doesn't block. The &lt;font face="Courier New"&gt;MessageQueue&lt;/font&gt; class in StorageClient
also provides the polling infrastructure under the covers and delivers the message
via eventing:
&lt;/p&gt;
&lt;font size=4&gt;&lt;font size=4&gt; 
&lt;p&gt;
&lt;/font&gt;&lt;font face="Courier New" size=2&gt;mq.MessageReceived += &lt;font color=#0000ff&gt;&lt;font color=#0000ff&gt;new&lt;/font&gt;&lt;/font&gt; &lt;font color=#2b91af&gt;&lt;font color=#2b91af&gt;MessageReceivedEventHandler&lt;/font&gt;&lt;/font&gt;(mq_MessageReceived);&lt;br&gt;
mq.PollInterval = 2000; &lt;font color=#008000&gt;// in milliseconds&lt;/font&gt;
&lt;br&gt;
mq.StartReceiving(); &lt;font color=#008000&gt;// start polling&lt;/font&gt;&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font size=4&gt;&lt;font color=#000000 size=2&gt;The event handler will fire every time a message
is received and when there are no more messages the client will start polling the
queue according to the &lt;font face="Courier New"&gt;PollInterval&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=4&gt;&lt;font color=#000000 size=2&gt;Bear in mind that the same semantics apply
to receiving messages. It is beholden on the receiver to delete the message within
the timeout otherwise the message will again become visible to other readers. Notice
here we don't explicitly set a timeout and so a default is picked up from the &lt;font face="Courier New"&gt;Timeout&lt;/font&gt; property
on the &lt;font face="Courier New"&gt;MessageQueue&lt;/font&gt; class (this defaults to 30 seconds).&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=4&gt;&lt;font color=#000000 size=2&gt;Using the code above it is very easy to think
that everything is running with a nicely tuned .NET API under the covers. Remember,
however,&amp;nbsp;that this infrastructure is actually exposed via internet standard protocols.
All we have here in reality is a convenient wrapper over the storage REST API. And
so bear in mind that the event model is just a convenience provided by the class library
and not an inherent feature built into queue storage. Similarly the reason that &lt;font face="Courier New"&gt;GetMessage&lt;/font&gt; doesn't
block is simply that it wraps an HTTP request that returns an empty queue message
list if there are no messages on the queue. If you use &lt;font face="Courier New"&gt;GetMessage&lt;/font&gt; or
eventing API then the messages are retrieved one at a time. You can also use the &lt;font face="Courier New"&gt;GetMessages&lt;/font&gt; API
which will allows you to receive multiple messages at once. &lt;/font&gt;
&lt;/p&gt;
&lt;/font&gt;&gt;&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=c24f8177-f6bf-479b-bd5c-d532e0e40272" /&gt;</description>
      <category>.NET;Azure;REST</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=38b4889c-b9a6-4576-a944-b9286637dc14</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been digging around in <a href="http://www.azure.com">Azure</a> Storage recently
and as a side project I decided to write an explorer for Blob Storage. My UI skills
are not my strongest suit but I had fun dusting off my WPF knowledge (I have to thank <a href="http://andyclymer.blogspot.com/">Andy
Clymer</a>, Dave "no blog" Wheeler and <a href="http://www.interact-sw.co.uk/iangblog/">Ian
Griffiths</a> for nursemaiding me through some issues)
</p>
        <p>
Here is a screen shot of the explorer attached to development storage. You can also
attach it to your hosted Azure storage in the cloud
</p>
        <p>
          <img src="http://www.dotnetconsult.co.uk/weblog2/content/binary/blobexplorer.jpg" border="0" />
        </p>
        <p>
In the spirit of cloud storage and dogfooding I used the Blob Explorer to upload
itself into the cloud so you can find it <a href="http://dotnetconsult.blob.core.windows.net/tools/BlobExplorer.zip?timeout=300">here</a></p>
        <p>
However, as Azure is a CTP environment I thought I would also upload it here
</p>
        <p>
          <a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer1.zip">BlobExplorer1.zip
(55.08 KB)</a>
          <a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer.zip">
          </a>
        </p>
        <p>
as, on the web, URIs live forever and my storage account URIs may not after
the CTP. I hope someone gets some mileage out of it - I certainly enjoyed writing
it. Comments, bug reports and feature requests are appreciated
</p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=38b4889c-b9a6-4576-a944-b9286637dc14" />
      </body>
      <title>Blob Storage Explorer</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,38b4889c-b9a6-4576-a944-b9286637dc14.aspx</link>
      <pubDate>Sat, 06 Dec 2008 22:00:19 GMT</pubDate>
      <description>&lt;p&gt;
I've been digging around in &lt;a href="http://www.azure.com"&gt;Azure&lt;/a&gt; Storage recently
and as a side project I decided to write an explorer for Blob Storage. My UI skills
are not my strongest suit but I had fun dusting off my WPF knowledge (I have to thank &lt;a href="http://andyclymer.blogspot.com/"&gt;Andy
Clymer&lt;/a&gt;, Dave "no blog" Wheeler&amp;nbsp;and &lt;a href="http://www.interact-sw.co.uk/iangblog/"&gt;Ian
Griffiths&lt;/a&gt; for nursemaiding me through some issues)
&lt;/p&gt;
&lt;p&gt;
Here is a screen shot of the explorer attached to development storage. You can also
attach it to your hosted Azure storage in the cloud
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.dotnetconsult.co.uk/weblog2/content/binary/blobexplorer.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
In the spirit of cloud storage and dogfooding I used the Blob&amp;nbsp;Explorer to upload
itself into the cloud so you can find it &lt;a href="http://dotnetconsult.blob.core.windows.net/tools/BlobExplorer.zip?timeout=300"&gt;here&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
However, as Azure is a CTP environment I thought I would also upload it here
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer1.zip"&gt;BlobExplorer1.zip
(55.08 KB)&lt;/a&gt;&lt;a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/BlobExplorer.zip"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
as, on the web, URIs live forever and my storage account&amp;nbsp;URIs&amp;nbsp;may not&amp;nbsp;after
the&amp;nbsp;CTP. I hope someone gets some mileage out of it - I certainly enjoyed writing
it. Comments, bug reports and feature requests are appreciated
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=38b4889c-b9a6-4576-a944-b9286637dc14" /&gt;</description>
      <category>.NET;Azure;BlobExplorer;REST;WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=46ca0e3d-b096-4746-87e6-d8670afbfdc4</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,46ca0e3d-b096-4746-87e6-d8670afbfdc4.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Thanks to all who came to my REST talk at Oredev 
</p>
        <p>
The slides are here
</p>
        <p>
          <a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/REST.pdf">REST.pdf
(325.61 KB)</a>
        </p>
        <p>
and the demos are here
</p>
        <p>
          <a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/REST.zip">REST.zip
(30.32 KB)</a>
        </p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=46ca0e3d-b096-4746-87e6-d8670afbfdc4" />
      </body>
      <title>Slides and demos from REST talk at Oredev</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,46ca0e3d-b096-4746-87e6-d8670afbfdc4.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,46ca0e3d-b096-4746-87e6-d8670afbfdc4.aspx</link>
      <pubDate>Fri, 21 Nov 2008 15:28:54 GMT</pubDate>
      <description>&lt;p&gt;
Thanks to all who came to my REST talk at Oredev 
&lt;/p&gt;
&lt;p&gt;
The slides are here
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/REST.pdf"&gt;REST.pdf
(325.61 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
and the demos are here
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetconsult.co.uk/weblog2/content/binary/REST.zip"&gt;REST.zip
(30.32 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=46ca0e3d-b096-4746-87e6-d8670afbfdc4" /&gt;</description>
      <category>.NET;ASP.NET;MVC;REST;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=b3840534-0f43-407d-b821-21980304bc08</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b3840534-0f43-407d-b821-21980304bc08.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was in Redmond a few weeks ago looking at the new stuff that Microsoft's Connected
System Division (CSD) were working on (WF 4.0, REST Toolkit, Oslo, Dublin). At the
end of the week I did an interview for <a href="http://blogs.msdn.com/rjacobs/">Ron
Jacobs</a> for Endpoint.tv on <a href="http://channel9.msdn.com/">Channel 9</a>. We
discussed WF 4.0, Dublin, Oslo and M - as well as 150 person <a href="http://www.develop.com/course/guerrilla-net">Guerrilla</a> courses.
You can watch it <a href=" http://channel9.msdn.com/shows/Endpoint/endpointtv-WCF-and-WF-40-First-Look-with-Richard-Blewett/" temp_href=" http://channel9.msdn.com/shows/Endpoint/endpointtv-WCF-and-WF-40-First-Look-with-Richard-Blewett/">here</a></p>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=b3840534-0f43-407d-b821-21980304bc08" />
      </body>
      <title>Interviewed on Channel 9</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b3840534-0f43-407d-b821-21980304bc08.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b3840534-0f43-407d-b821-21980304bc08.aspx</link>
      <pubDate>Mon, 03 Nov 2008 23:12:08 GMT</pubDate>
      <description>&lt;p&gt;
I was in Redmond a few weeks ago looking at the new stuff that Microsoft's Connected
System Division (CSD) were working on (WF 4.0, REST Toolkit, Oslo, Dublin). At the
end of the week I did an interview for &lt;a href="http://blogs.msdn.com/rjacobs/"&gt;Ron
Jacobs&lt;/a&gt; for Endpoint.tv on &lt;a href="http://channel9.msdn.com/"&gt;Channel 9&lt;/a&gt;. We
discussed WF 4.0, Dublin, Oslo and M - as well as 150 person &lt;a href="http://www.develop.com/course/guerrilla-net"&gt;Guerrilla&lt;/a&gt; courses.
You can watch it&amp;nbsp;&lt;a href=" http://channel9.msdn.com/shows/Endpoint/endpointtv-WCF-and-WF-40-First-Look-with-Richard-Blewett/" temp_href=" http://channel9.msdn.com/shows/Endpoint/endpointtv-WCF-and-WF-40-First-Look-with-Richard-Blewett/"&gt;here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=b3840534-0f43-407d-b821-21980304bc08" /&gt;</description>
      <category>.NET;BizTalk;Oslo;REST;WCF;WF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=0bfe5013-e13c-4a1b-a686-600226137ff1</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,0bfe5013-e13c-4a1b-a686-600226137ff1.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <title>PDC Download - Part 1: Windows Azure</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,0bfe5013-e13c-4a1b-a686-600226137ff1.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,0bfe5013-e13c-4a1b-a686-600226137ff1.aspx</link>
      <pubDate>Sat, 01 Nov 2008 02:39:23 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Having spent the last week at PDC - with very
spotty Internet access. I thought I'd take some time to reflect on what I thought
about the various announcements and technologies that I dug around in.&lt;/font&gt;&lt;font face=Calibri color=#000000 size=3&gt; This&amp;nbsp;post
is about the big announcement: Windows Azure&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Azure (apparently pronounced to rhyme with
badger) is an infrastructure designed to control applications installed in a huge
datacenter. Microsoft refer to it as a “cloud based operating system” and talk about
it being where you deploy your apps for Internet&amp;nbsp; scale.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;So I guess we have to start with: what problem
are Microsoft trying to solve? There are two answers here:&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face=Calibri size=3&gt;1)&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri size=3&gt;Applications
that need Internet scale are really hard to deploy due to the potentially huge hardware
requirements and cost of managing that infrastructure. Most organizations that go
through rapid growth experience a lot of pain as they try to scale for the 10,000s
to many millions of users (Pinku has some great slides on the pain MySpace went through
and how they solved it). This normally requires rearchitecting of the app to more
loosely couple, etc. &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face=Calibri size=3&gt;2)&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri size=3&gt;Microsoft
have a serious threat from both Amazon and Google in the high scaling world as both
of those companies already have “cloud solutions” in place. They had to do something
to ensure they were not left behind.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;So Microsoft started the project to create
an infrastructure to allow customers to deploy applications into Microsoft’s datacenter
that would seamlessly scale as their requirements grew – Azure is the result.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;The idea then is that you write your software
and tell Microsoft what facilities you require – this is in the form of a manifest
config file: “I require 20 instances of the web front end and 5 instances of the data
processing engine”. The software and config is then deployed in to Microsoft’s infrastructure
and a component called the &lt;em&gt;Fabric Controller &lt;/em&gt;maps the software on to virtual
machines under the control of a hypervisor. They also put a load balancer in front
of the web&amp;nbsp; front end. The web site runs as a “web role” that can accept requests
from the Internet and the processing engine gets mapped to a “worker role” that cannot
be accessed externally.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;The Fabric Controller has responsibility to
ensure that there are always a number of running instances your components even in
the face of hardware failures. It will also ensure that you can perform rolling upgrades
without taking your app offline if that what you require.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;The problem that apps then face is that even
though they may run on a specific machine at one point, the next time they are initialized
they may be on a completely separate machine and so storing anything locally is pointless
apart from as a localized cache. That begs the question: where do I store my state?
Enter the Azure Storage Service. This is a massively scalable, fault tolerant, highly
available storage system. There are three types of storage available&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Blob: Unstructured data with sizes up to 50Gb&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Table: Structured tabular data with up to
252 user defined properties (think columns)&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Queue: queue based data for storing messages
to be passed from one component to another in the azure infrastructure&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Hopefully Blob and Queue are fairly familiar
constructs to most people. Table probably needs a little clarification. We are not
talking about a relational database here. There is no schema for the table based data
so, in fact, every row could be shaped completely differently (although this would
be pretty ugly to try to read back out again). There are no relations and therefore
no joins. There are also no server managed indexes – you define a pseudo index with
the idea of a partition ID – this ID can be used to horizontally partition the data
across multiple machine clusters but the partition ID is something you are responsible
for managing. However, each row must be uniquely identifiable so there is also a concept
of a row id and the partition id/row id combination make up the primary key of the
table. There is also a system maintained version number for concurrency control. So
this is where the strange number of 252 user defined properties comes from 255 – 3
(partition id, row id, version)&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;So in the above example, the web front end
passes the data processing engine the data by enqueing it into queue storage. The
processing engine then stores the data further (say in a blob or table) or just processes
and pushes the results back on another queue. It can also send messages out to external
endpoints.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;All components run under partial trust (a
variant similar to ASP.NET medium trust) so Azure developers will need some understanding
of CAS. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;The API for talking to Azure is REST based
which can be wrapped by ADO.NET Data Services if appropriate (e.g. for table storage)&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;To get started you need an account provisioned
(to get space reserved in the datacenter). You can do this via &lt;/font&gt;&lt;a href="http://www.azure.com/"&gt;&lt;font face=Calibri color=#0000ff size=3&gt;http://www.azure.com&lt;/font&gt;&lt;/a&gt;&lt;font face=Calibri color=#000000 size=3&gt;.
There are other services built on top of Azure, which I will cover in subsequent posts,
which get provisioned in the same place.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;There is an SDK and VS2008 SP1 integration.
This brings a development fabric to your machine that has the same services available
as the cloud based one so you can test without deploying into the cloud. There are
also VS project templates which in fact create multiple projects: the application
one(s) and another to specify the deployment configuration.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;So where does that leave Microsoft. They&amp;nbsp;have
created an offering that in its totality (which is much more than I have talked about
here) is beyond what both Amazon and Google have created in terms of functionality.
But they are left with two issues: &lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face=Calibri size=3&gt;1)&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri size=3&gt;Will
companies trust Microsoft to run their business critical applications? Some definitely
will but others will reserve judgement for some time until they have seen in practice
that this infrastructure is sound. Microsoft say they will also have an SLA in the
contract that will have financial penalty clauses if they fail to fulfil it in some
currently unspecified way&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face=Calibri size=3&gt;2)&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face=Calibri size=3&gt;Microsoft
have not yet announced any pricing model. This leaves companies in a difficult position
– do they throw resources at a project with a lot of potential and bear the risk that
when Microsoft unveil the pricing their application is not economically viable? Or
do they wait to start investing in this technology until Microsoft announce pricing.
Unfortunately this is a chicken and egg situation – Microsoft cannot go live commercially
&amp;nbsp;until the infrastructure has been proven in practice by companies creating serious
app on it, and yet they do not want to announce pricing until they are ready for commercial
release. Hopefully they will be prepared to discuss pricing for any organization that
it serious about building on the infrastructure on a case by case basis before full
commercial release.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;font face=Calibri color=#000000 size=3&gt; 
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&lt;font face=Calibri color=#000000 size=3&gt;Azure definitely has huge potential for those
companies that need a very flexible approach to scale or who will require scale over
time but that time cannot yet be determined. It also has some challenges for how you
build applications - there are design constraints you have to cater for (failure is
a fact of life and you have to code to accept that for example). &lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;
Definitely interesting times
&lt;/p&gt;
&lt;/font&gt;&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=0bfe5013-e13c-4a1b-a686-600226137ff1" /&gt;</description>
      <category>.NET;Azure;REST</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=f4c218cd-6de0-42fb-ad4a-3393c49ec542</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f4c218cd-6de0-42fb-ad4a-3393c49ec542.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
          <a href="http://www.oredev.org">
            <img src="http://www.dotnetconsult.co.uk/weblog2/content/binary/oredev.jpg" border="0" />
          </a>
        </p>
        <p>
I'm going to be doing a couple of sessions at the <a href="http://www.oredev.org">Oredev</a> conference
in Sweden in November
</p>
        <p>
          <span class="normal">
            <strong>Writing REST based Systems with .NET</strong>
          </span>
        </p>
        <p>
          <span class="normal">For many, building large scale service based systems equate to
using SOAP. There is, however, another way to architect service based systems by embracing
the model the web uses - REpresentational State Transfer, or REST. .NET 3.5 introduced
a way of building the service side with WCF - however you can also use ASP.NET's infrastructure
as well. In this session we talk about what REST is, two approaches to creating REST
based services and how you can consume these services very simply with LINQ to XML.</span>
        </p>
        <span class="normal">
          <p style="PADDING-TOP: 1em">
            <span class="normal">
              <strong>Writing Service Oriented Systems with WCF and Workflow</strong>
            </span>
          </p>
          <p>
            <span class="normal">Since its launch WCF has been Microsoft's premier infrastructure
to writing SOA based systems. However one of the main benefits of Service Orientation
is combining the functionality of services to create higher order functionality which
itself is exposed as a service - namely service composition. Workflow is a very descriptive
way of showing how services are combined and in .NET 3.5 Microsoft introduced an integration
layer between WCF and Workflow to simplify the job of service composition. In this
session we examine this infrastructure and bring out both its string and weak points
with an eye to what is coming down the line in Project Oslo - Microsoft's next generation
of its SOA platform.</span>
          </p>
          <p>
            <span class="normal">Hope to see you there</span>
          </p>
        </span>
        <img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=f4c218cd-6de0-42fb-ad4a-3393c49ec542" />
      </body>
      <title>Speaking at Oredev</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f4c218cd-6de0-42fb-ad4a-3393c49ec542.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f4c218cd-6de0-42fb-ad4a-3393c49ec542.aspx</link>
      <pubDate>Tue, 16 Sep 2008 12:45:26 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.oredev.org"&gt;&lt;img src="http://www.dotnetconsult.co.uk/weblog2/content/binary/oredev.jpg" border=0&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I'm going to be doing a couple of sessions at the &lt;a href="http://www.oredev.org"&gt;Oredev&lt;/a&gt; conference
in Sweden in November
&lt;/p&gt;
&lt;p&gt;
&lt;span class=normal&gt;&lt;strong&gt;Writing REST based Systems with .NET&lt;/strong&gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;span class=normal&gt;For many, building large scale service based systems equate to
using SOAP. There is, however, another way to architect service based systems by embracing
the model the web uses - REpresentational State Transfer, or REST. .NET 3.5 introduced
a way of building the service side with WCF - however you can also use ASP.NET's infrastructure
as well. In this session we talk about what REST is, two approaches to creating REST
based services and how you can consume these services very simply with LINQ to XML.&lt;/span&gt;
&lt;/p&gt;
&lt;span class=normal&gt; 
&lt;p style="PADDING-TOP: 1em"&gt;
&lt;span class=normal&gt;&lt;strong&gt;Writing Service Oriented Systems with WCF and Workflow&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class=normal&gt;Since its launch WCF has been Microsoft's premier infrastructure
to writing SOA based systems. However one of the main benefits of Service Orientation
is combining the functionality of services to create higher order functionality which
itself is exposed as a service - namely service composition. Workflow is a very descriptive
way of showing how services are combined and in .NET 3.5 Microsoft introduced an integration
layer between WCF and Workflow to simplify the job of service composition. In this
session we examine this infrastructure and bring out both its string and weak points
with an eye to what is coming down the line in Project Oslo - Microsoft's next generation
of its SOA platform.&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class=normal&gt;Hope to see you there&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt;&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=f4c218cd-6de0-42fb-ad4a-3393c49ec542" /&gt;</description>
      <category>.NET;ASP.NET;LINQ;MVC;Oslo;REST;WCF;WF</category>
    </item>
    <item>
      <trackback:ping>http://www.dotnetconsult.co.uk/weblog2/Trackback.aspx?guid=f975f04c-1bce-4169-8e2b-8b9db0d012e0</trackback:ping>
      <pingback:server>http://www.dotnetconsult.co.uk/weblog2/pingback.aspx</pingback:server>
      <pingback:target>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f975f04c-1bce-4169-8e2b-8b9db0d012e0.aspx</pingback:target>
      <dc:creator>Richard Blewett</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been looking at the routing infrastructure Microsoft are releasing in <a href="http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx">.NET
3.5 SP1</a>. This is the infrastructure that allows me to bind an HTTP Hander to a
URI rather than simply using webforms. It is used in the <a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx">ASP.NET
MVC</a> framework that is in development. The infrastructure is pretty clean in design,
First you add a reference to <font face="Courier New">System.Web.Routing.</font> Then you
simply create <font face="Courier New">Route</font> objects binding a URI to an implementation
of <font face="Courier New">IRouteHandler. </font>Finally you add it to a <font face="Courier New">RouteTable</font> static
class. <font face="Courier New">Global.asax</font> is the ideal spot for this code.
</p>
        <p>
          <font face="Courier New">
            <font color="#0000ff">void</font> Application_Start(<font color="#0000ff">object</font> sender,
EventArgs e) <br />
{<br />
        Route r = <font color="#0000ff">new</font> Route("books", <font color="#0000ff">new</font> BooksRouteHandler());<br />
        RouteTable.Routes.Add(r);<br />
        r = <font color="#0000ff">new</font> Route("books/isbn/{isbn}", <font color="#0000ff">new</font> BooksRouteHandler());<br />
        RouteTable.Routes.Add(r);<br />
        r = <font color="#0000ff">new</font> Route("search/price", <font color="#0000ff">new</font> SearchRouteHandler());<br />
        RouteTable.Routes.Add(r);<br />
}</font>
        </p>
        <p>
Here <font face="Courier New">BooksRouteHandler</font> and <font face="Courier New">SearchRouteHandler</font> implement <font face="Courier New">IRouteHandler</font></p>
        <p>
          <font face="Courier New">
            <font color="#0000ff">public interface</font> IRouteHandler<br />
{<br />
    IHttpHandler GetHttpHandler(RequestContext requestContext);<br />
}</font>
        </p>
        <p>
So for example the BooksRouteHandler looks like this
</p>
        <p>
          <font face="Courier New">
            <font color="#0000ff">public</font>
            <font color="#0000ff">class</font> BooksRouteHandler
: IRouteHandler<br />
{<br /></font>
          <font face="Courier New">    <font color="#0000ff">public</font> IHttpHandler
GetHttpHandler(RequestContext requestContext)<br />
    {<br />
        <font color="#0000ff">if</font> (requestContext.RouteData.Values.ContainsKey("isbn"))<br />
        {<br />
            <font color="#0000ff">string</font> isbn
= (string)requestContext.RouteData.Values["isbn"];<br />
            <font color="#0000ff">return</font><font color="#0000ff">new</font> ISBNHandler(isbn);<br />
        }<br />
        <font color="#0000ff">else</font><br />
        {<br />
            <font color="#0000ff">return
new</font> BooksHandler();<br />
        }<br />
    }<br /></font>
          <font face="Courier New">}</font>
        </p>
        <p>
Where <font face="Courier New">ISBNHandler</font> and <font face="Courier New">BooksHandler</font> both
implement <font face="Courier New">IHttpHandler</font></p>
        <p>
This is all pretty straightforward. The one thing that had me puzzling for a while
is who looks at the <font face="Courier New">RouteTable</font>. <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a> to
the rescue! There is a module in the <font face="Courier New">System.Web.Routing</font> assembly
called <font face="Courier New">UrlRoutingModule</font>. If you add this in to your <font face="Courier New">web.config</font> the
routing starts working. The config piece looks like this
</p>
        <p>
          <font face="Courier New">&lt;httpModules&gt;<br />
      &lt;add name="Routing" <br />
           type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;<br />
&lt;/httpModules&gt;<br /></font>
        </p>
        <br />
I'm currently using it to build a REST based service for the second part of a two
part article for the <a href="http://www.develop.com/">DevelopMentor</a> DevelopMents
newsletter so if you're not on the distribution list for that <a href="http://www.develop.com/us/user/myprofile.aspx">subscribe!</a><img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=f975f04c-1bce-4169-8e2b-8b9db0d012e0" /></body>
      <title>Using the ASP.NET Routing infrastructure in .NET 3.5 SP1</title>
      <guid isPermaLink="false">http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f975f04c-1bce-4169-8e2b-8b9db0d012e0.aspx</guid>
      <link>http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,f975f04c-1bce-4169-8e2b-8b9db0d012e0.aspx</link>
      <pubDate>Wed, 18 Jun 2008 09:36:52 GMT</pubDate>
      <description>&lt;p&gt;
I've been looking at the routing infrastructure Microsoft are releasing in &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx"&gt;.NET
3.5 SP1&lt;/a&gt;. This is the infrastructure that allows me to bind an HTTP Hander to a
URI rather than simply using webforms. It is used in the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx"&gt;ASP.NET
MVC&lt;/a&gt; framework that is in development. The infrastructure is pretty clean in design,
First you add a reference to &lt;font face="Courier New"&gt;System.Web.Routing.&lt;/font&gt; Then&amp;nbsp;you
simply create &lt;font face="Courier New"&gt;Route&lt;/font&gt; objects binding a URI to an implementation
of &lt;font face="Courier New"&gt;IRouteHandler. &lt;/font&gt;Finally you add it to a &lt;font face="Courier New"&gt;RouteTable&lt;/font&gt; static
class. &lt;font face="Courier New"&gt;Global.asax&lt;/font&gt; is the ideal spot for this code.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;void&lt;/font&gt; Application_Start(&lt;font color=#0000ff&gt;object&lt;/font&gt; sender,
EventArgs e)&amp;nbsp;&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Route r = &lt;font color=#0000ff&gt;new&lt;/font&gt; Route("books", &lt;font color=#0000ff&gt;new&lt;/font&gt; BooksRouteHandler());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RouteTable.Routes.Add(r);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r = &lt;font color=#0000ff&gt;new&lt;/font&gt; Route("books/isbn/{isbn}", &lt;font color=#0000ff&gt;new&lt;/font&gt; BooksRouteHandler());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RouteTable.Routes.Add(r);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r = &lt;font color=#0000ff&gt;new&lt;/font&gt; Route("search/price", &lt;font color=#0000ff&gt;new&lt;/font&gt; SearchRouteHandler());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RouteTable.Routes.Add(r);&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Here &lt;font face="Courier New"&gt;BooksRouteHandler&lt;/font&gt; and &lt;font face="Courier New"&gt;SearchRouteHandler&lt;/font&gt; implement &lt;font face="Courier New"&gt;IRouteHandler&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;public interface&lt;/font&gt; IRouteHandler&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IHttpHandler GetHttpHandler(RequestContext requestContext);&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
So for example the BooksRouteHandler looks like this
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&lt;font color=#0000ff&gt;public&lt;/font&gt; &lt;font color=#0000ff&gt;class&lt;/font&gt; BooksRouteHandler
: IRouteHandler&lt;br&gt;
{&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;public&lt;/font&gt; IHttpHandler
GetHttpHandler(RequestContext requestContext)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;if&lt;/font&gt; (requestContext.RouteData.Values.ContainsKey("isbn"))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;string&lt;/font&gt; isbn
= (string)requestContext.RouteData.Values["isbn"];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;return&lt;/font&gt; &lt;font color=#0000ff&gt;new&lt;/font&gt; ISBNHandler(isbn);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;else&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#0000ff&gt;return
new&lt;/font&gt; BooksHandler();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Where &lt;font face="Courier New"&gt;ISBNHandler&lt;/font&gt; and &lt;font face="Courier New"&gt;BooksHandler&lt;/font&gt; both
implement &lt;font face="Courier New"&gt;IHttpHandler&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This is all pretty straightforward. The one thing that had me puzzling for a while
is who looks at the &lt;font face="Courier New"&gt;RouteTable&lt;/font&gt;. &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Reflector&lt;/a&gt; to
the rescue! There is a module in the &lt;font face="Courier New"&gt;System.Web.Routing&lt;/font&gt; assembly
called &lt;font face="Courier New"&gt;UrlRoutingModule&lt;/font&gt;. If you add this in to your &lt;font face="Courier New"&gt;web.config&lt;/font&gt; the
routing starts working. The config piece looks like this
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;httpModules&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="Routing"&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&amp;gt;&lt;br&gt;
&amp;lt;/httpModules&amp;gt;&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;br&gt;
I'm currently using it to build a REST based service for the second part of a two
part article for the &lt;a href="http://www.develop.com/"&gt;DevelopMentor&lt;/a&gt; DevelopMents
newsletter so if you're not on the distribution list for that &lt;a href="http://www.develop.com/us/user/myprofile.aspx"&gt;subscribe!&lt;/a&gt;&lt;img width="0" height="0" src="http://www.dotnetconsult.co.uk/weblog2/aggbug.ashx?id=f975f04c-1bce-4169-8e2b-8b9db0d012e0" /&gt;</description>
      <category>.NET;ASP.NET;REST;MVC</category>
    </item>
  </channel>
</rss>