<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Shiju Varghese's Blog</title><link>http://weblogs.asp.net/shijuvarghese/default.aspx</link><description>Cloud Development with Windows Azure</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ShijuVBlog" /><feedburner:info uri="shijuvblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>ShijuVBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Scaling Node.js Real-time Apps with Windows Azure Service Bus</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/Sk6AsL1-fAY/scaling-node-js-real-time-apps-with-windows-azure-service-bus.aspx</link><pubDate>Mon, 10 Jun 2013 16:08:09 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10377514</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10377514</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10377514</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/06/10/scaling-node-js-real-time-apps-with-windows-azure-service-bus.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, I will demonstrate how to scale out real-time Socket.IO apps with Windows Azure Service Bus by leveraging the Node.js module Socket.IO-ServiceBus. The Node module &lt;a href="https://github.com/WindowsAzure/socket.io-servicebus" target="_blank"&gt;Socket.IO-ServiceBus&lt;/a&gt; lets the Node.js developers scale out the Socket.IO apps to multiple servers, which will work with Socket.IO store, provided by Windows Azure Service Bus Topic. The only Windows Azure component you need to scale out your Socket.IO apps with Socket.IO-ServiceBus, is Windows Azure Service Bus Topic. You can deploy your Socket.IO apps into any cloud platform or on-premise servers and, the apps deployed in multiples servers, that will be work through the Windows Azure Service Bus. This blog post assumes that you have already worked with Socket.IO apps and will be focused on how to scale out Socket.IO apps with Windows Azure Service Bus. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Socket.IO for Real-time Web Apps&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Socket.IO is one of the most popular Node.js modules, which is widely used for building real-time web apps on the Node.js platform. Socket.IO provides cross-browser real-time communication to web browsers which&amp;#160; enables bi-directional communication between the server and browser client. Socket.IO leverages HTML 5 WebSocket if the browsers are support it, otherwise, it will use some browser-specific tricks to simulate the behavior provided by WebSockets, regardless of browser versions. Socket.IO can be used for building real-time apps such as Web Chats, Real-time Games, Stock monitoring apps, Push Notification Hubs, Real-time APIs, etc. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Scale Out Socket.IO Apps to multiple Servers with Socket.IO-ServiceBus&lt;/strong&gt;&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Node.js is a single threaded, asynchronous programming model, which enables a non-blocking execution models for developing web apps and networking apps. By default, for Node.js apps, you can’t leverage multi core machines, since Node.js is based on single threaded execution model, which will be leveraged single core of the server machine. But you can leverage multi cores of the server machine by leveraging the Node.js Cluster module. The problem with Socket.IO is that it would be difficult to scale out the Socket.IO server to multiple processes and multiple servers. Socket.IO provides a feature named Store which can be used for scale out Socket.IO apps to multiple processes. The Windows Azure Service Bus extends the Socket.IO store by providing a store option in Windows Azure, which provides greater scalability&amp;#160; for scaling the Socket.IO apps to multiple processes and multiple servers regardless of data centers used for the server apps. Socket.IO-ServiceBus is the module developed by Microsoft Windows Azure Team for scale out Socket.IO apps with the help of Windows Azure Service Bus Topics. The beauty of the Socket.IO-ServiceBus is that it is not necessary to deploy your Socket.IO apps in Windows Azure. You can deploy your Socket.IO apps in any cloud platform or your own on-premise server. The only essential component for working with Socket.IO-ServiceBus is Windows Azure Service Bus Topic. Socket.IO-ServiceBus will leverage the Windows Azure Service Bus Topic as the store option for Socket.IO server instances. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following are the basic steps for configuring Socket.IO store with Windows Azure Service Bus using the Socket.IO-ServiceBus &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 1 – Create Windows Azure Service Bus Namespace and Topic&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In order to working with Socket.IO-ServiceBus, we need to create a Windows Azure Service Bus namespace and Topic to configuring the store for Socket.IO server. To create a Windows Azure Service Bus namespace, go to&amp;#160; Windows Azure management portal, select Service Bus from left pane, click Create from lower side of the windows and add a new namespace as shown in the following picture&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_55C69390.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_533D61D2.png" width="456" height="331" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can copy the connection string of Service Bus from “Connect Info” button, after the choosing the namespace, which you want to copy the connection string.&lt;/font&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_3E6B6952.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_02CB5A92.png" width="625" height="642" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We have created a namespace in Windows Azure Service Bus. Let’s create a Windows Azure Service Bus Topic within the namespace we have created in the previous step, for configuring the Service Bus store for Socket.IO server apps. To create a Service Bus Topic, select New from the lower left corner, select App Services, Service Bus, , Topic and click Quick Create and give the Topic Name and choose region and Namespace. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4FCBA45D.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_27D87F31.png" width="715" height="391" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 2 – Configure Windows Azure Service Bus Store for Socket.IO Servers&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the step 1, we have created Windows Azure Service Bus namespace and Topic. In this step, let’s configure the Windows Azure Service Bus store for Socket.IO. First, add the npm module &lt;a href="https://npmjs.org/package/socket.io-servicebus" target="_blank"&gt;socket.io-servicebus&lt;/a&gt; to your Socket.IO app. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_045BDACC.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_1C131232.png" width="496" height="38" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below configures the socket.io-servicebus module with Windows Azure Service Bus connection string and topic name.&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; socketio = require(&lt;span class="str"&gt;'socket.io'&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;    ,SbStore = require(&lt;span class="str"&gt;'socket.io-servicebus'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; io = socketio.listen(server);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;//Configure Service Bus Store&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;io.configure(&lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;  io.set(&lt;span class="str"&gt;'store'&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; SbStore({&lt;/pre&gt;

  &lt;pre class="alt"&gt;    topic: topicName,&lt;/pre&gt;

  &lt;pre&gt;    connectionString: sbconn&lt;/pre&gt;

  &lt;pre class="alt"&gt;  }));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In above code block, the variable name topicName contains the name of Windows Azure Service Bus Topic and the variable name sbconn contains the connection string for Windows Azure Service Bus. You can deploy the Socket.IO apps to any number of servers and the only piece of code you need to do is configure the socket.io-servicebus module with above code block.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The npm module socket.io-servicebus, developed by Windows Azure team, is an excellent framework which lets the Node.js developers to build highly scalable real-time Node.js apps by simply leveraging Windows Azure Service Bus. The socket.io-servicebus does not restrict you to deploying your Node.js server apps only with Windows Azure. You can deploy your Socket.IO apps to any kind of servers and the only Windows Azure component you required is the Windows Azure Service Bus subscription. The socket.io-servicebus&amp;#160; is an open source framework that available in github from &lt;a href="https://npmjs.org/package/socket.io-servicebus" target="_blank"&gt;here&lt;/a&gt;. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;I would greatly appreciate the Windows Azure team for their openness and contributions to OSS systems. I hope that socket.io-servicebus will enable better performance in future releases which will enable us to building mission critical real-time Node.js apps with Windows Azure Service Bus.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on twitter at &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10377514" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/Sk6AsL1-fAY" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/JavaScript/default.aspx">JavaScript</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/06/10/scaling-node-js-real-time-apps-with-windows-azure-service-bus.aspx</feedburner:origLink></item><item><title>Edge.js - Running Node.js and .NET in One Process</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/UfRR6fkMzE4/edge-js-running-node-js-and-net-in-one-process.aspx</link><pubDate>Wed, 29 May 2013 08:56:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10364016</guid><dc:creator>shiju</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10364016</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10364016</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/05/29/edge-js-running-node-js-and-net-in-one-process.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;C# is the most powerful static type programming language which can be used for developing wide variety of applications. Node.js is a server-side JavaScript platform which can be used for building high performance scalable applications on the V8 JavaScript engine. .NET provides more than 11,000 packages via NuGet and Node.js provides more than 30,000 modules via NPM. It would be great if we could use both .NET and Node.js platforms in one place. Edge.js is a Node.js npm module that lets the developers to run .NET and Node.js code in one process, where you can call&amp;#160; .NET functions from Node.js and Node.js functions from .NET. With Edge.js, you can call C# async lambda from node.js. Both .NET and Node.js are using different threading models, but Edge does handle the threading models of single threaded V8 and multi-threaded CLR. Currently Edge.js supports to use JavaScript with C#, F#, Python, and PowerShell. Edge.js was developed by &lt;a href="http://tomasz.janczuk.org/" target="_blank"&gt;Tomasz Janczuk&lt;/a&gt;. The Edge.js framework hosted on Github at &lt;a href="https://github.com/tjanczuk/edge"&gt;https://github.com/tjanczuk/edge&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following components required for working with Edge.js framework:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Node.js 0.6.x or later &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;.NET 4.5&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="https://npmjs.org/package/edge" target="_blank"&gt;Edge NPM Module&lt;/a&gt;&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Working with Edge.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You first install to Edge.js using npm in order to working Edge.js framework&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_52490F3F.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_68BBADC6.png" width="642" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Calling C# class from Node.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides a sample Node.js program which is using C# code for converting images from one image format to another image format&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; edge = require(&lt;span class="str"&gt;'edge'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; convertImage = edge.func(&lt;span class="kwrd"&gt;function&lt;/span&gt;() {&lt;span class="rem"&gt;/*&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;#r &amp;quot;System.Drawing.dll&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="rem"&gt; using System;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="rem"&gt; using System.Threading.Tasks;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="rem"&gt; using System.Collections.Generic;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="rem"&gt; using System.Drawing;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="rem"&gt; using System.Drawing.Imaging;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="rem"&gt; class Startup&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="rem"&gt;{&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&lt;span class="rem"&gt;  static IDictionary&amp;lt;string, ImageFormat&amp;gt; formats&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="rem"&gt;            = new Dictionary&amp;lt;string, ImageFormat&amp;gt; &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="rem"&gt;        {&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&lt;span class="rem"&gt;            { &amp;quot;jpg&amp;quot;, ImageFormat.Jpeg },&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&lt;span class="rem"&gt;            { &amp;quot;bmp&amp;quot;, ImageFormat.Bmp },&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&lt;span class="rem"&gt;            { &amp;quot;gif&amp;quot;, ImageFormat.Gif },&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&lt;span class="rem"&gt;            { &amp;quot;tiff&amp;quot;, ImageFormat.Tiff },&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&lt;span class="rem"&gt;            { &amp;quot;png&amp;quot;, ImageFormat.Png }&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&lt;span class="rem"&gt;        };&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&lt;span class="rem"&gt;public async Task&amp;lt;object&amp;gt; Invoke(&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&lt;span class="rem"&gt;                IDictionary&amp;lt;string,object&amp;gt; input)&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;&lt;span class="rem"&gt; {&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;&lt;span class="rem"&gt;       await Task.Run(async () =&amp;gt; {&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&lt;span class="rem"&gt;          using (Image image = Image.FromFile(&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&lt;span class="rem"&gt;                  (string)input[&amp;quot;source&amp;quot;]))&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&lt;span class="rem"&gt;   {&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&lt;span class="rem"&gt;          image.Save((string)input[&amp;quot;destination&amp;quot;], &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&lt;span class="rem"&gt;                 formats[(string)input[&amp;quot;toType&amp;quot;]]);&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&lt;span class="rem"&gt;       }&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&lt;span class="rem"&gt;   });&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&lt;span class="rem"&gt;            return null;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;&lt;span class="rem"&gt;        }&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&lt;span class="rem"&gt;    }&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&lt;span class="rem"&gt;*/&lt;/span&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; &lt;span class="kwrd"&gt;params&lt;/span&gt; = { &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    source: &lt;span class="str"&gt;'.\\shiju.png'&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;    destination: &lt;span class="str"&gt;'.\\shiju.jpg'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    toType: &lt;span class="str"&gt;'jpg'&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;};&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;convertImage(&lt;span class="kwrd"&gt;params&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) &lt;span class="kwrd"&gt;throw&lt;/span&gt; error;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48: &lt;/span&gt;console.log(&lt;span class="str"&gt;'The image shiju.png has been asynchronously converted to shiju.jpg'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are using the C# code using the edge.func where you can put C# async lambdas. In the above code block, we are using a C# class, which can be specified using the class name Startup with an Invoke method that matches the Func&amp;lt;object,Task&amp;lt;object&amp;gt;&amp;gt; delegate signature. We can add reference to the .Net assemblies using #r. The above program will convert the image to jpg format from png format where conversion logic was written in C# and called it from Node.js &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can run the above program as a normal node.js program as shown in the below command prompt:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_655A161E.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_4B19ACFA.png" width="554" height="46" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;

&lt;pre&gt;&amp;#160;&lt;/pre&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10364016" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/UfRR6fkMzE4" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/05/29/edge-js-running-node-js-and-net-in-one-process.aspx</feedburner:origLink></item><item><title>Consuming  Windows Azure Mobile Services REST API from ASP.NET Web API App</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/fsMOxAiiU-Q/consuming-windows-azure-mobile-services-rest-api-from-asp-net-web-api-app.aspx</link><pubDate>Sun, 12 May 2013 09:59:18 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10276779</guid><dc:creator>shiju</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10276779</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10276779</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/05/12/consuming-windows-azure-mobile-services-rest-api-from-asp-net-web-api-app.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services lets the developers to use structured storage, user authentication and push notifications to Android, iOS, HTML, Windows Store, or Windows Phone 8 apps&amp;#160; by leveraging the Windows Azure Cloud platform. Using with &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services, you can enjoy the scalability power of Cloud to your Mobile apps. In this blog post, I will demonstrate how to persist data on Windows Azure Mobile Services Table from a ASP.NET Web API app by leveraging the Windows Azure Mobile Services REST API, and finally provides a generic type helper class for performing CRUD operations on the Windows Azure Mobile Services Table.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Consuming Windows Azure Mobile Services REST API from a ASP.NET Web API App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services provides native API for Android, iOS, HTML, Windows Store, or Windows Phone 8 apps&amp;#160; so that you can directly consume the &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services from your native Mobile apps. In this post, we will be consume the &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services from a&amp;#160; ASP.NET Web API app. &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services provides REST API so that we can easily consume it form our ASP.NET Web API app. This use case is based on a real world app I have recently worked, where iOS clients are consuming a REST API written in ASP.NET Web API and for some persistence over the REST API, we need to send push notifications to the iOS clients. So we are consuming the Windows Azure Mobile Services REST API from ASP.NET Web API app where we need to send push notifications. In this post, I am directly consuming the REST API from my app instead of using any REST API wrapper for .Net clients so that we can explore the &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services &lt;/font&gt;REST API.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;A Generic CRUD Helper Class for Windows Azure Mobile Services Table&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create a generic type class for CRUD operations on the Windows Azure Mobile Services Table by consuming the REST API of &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services. This generic type helper class can work with any type of Model object.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c67ee718-09a0-4157-a1ec-edeb20fa0876" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;class&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;MobileServiceRequestHelper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;lt;T&amp;gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;where&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; T : &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;class&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;private&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;string&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; tableEndpoint;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;private&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;string&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; applicationKey;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;private&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpClient&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; client;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; MobileServiceRequestHelper(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;string&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; tableName)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;tableEndpoint = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;ConfigurationManager&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="background:#ffffff;color:#000000"&gt;.AppSettings[&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;TableEndpoint&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;] + tableName ;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;applicationKey = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;ConfigurationManager&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="background:#ffffff;color:#000000"&gt;.AppSettings[&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;X-ZUMO-APPLICATION&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;];&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;client = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpClient&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;();&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;client.DefaultRequestHeaders.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="background:#ffffff;color:#000000"&gt;Add(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;X-ZUMO-APPLICATION&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;, applicationKey);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;client.DefaultRequestHeaders.Accept&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="background:#ffffff;color:#000000"&gt;.Add(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;MediaTypeWithQualityHeaderValue&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;));&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We are taking the application key and Mobile Services URI from the web.config table and we will pass the Windows Azure Table name in the constructor method of our generic type helper class.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Insert Operation&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The API documentation for Insert record operation available from &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj677200.aspx" target="_blank"&gt;here&lt;/a&gt;. The code block below provides the implementation of HTTP Post for inserting a new record onto Windows Azure Mobile Services Table. We are serializing the model object as JSON format and executing the HTTP request by calling the SendAsync method of HTTPClient class.&lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e7bc193b-5d69-4780-a02a-f1949e1da3ed" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;bool&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Post(T requestData)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; obj = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JsonConvert&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.SerializeObject(requestData,&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JsonSerializerSettings&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;()&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;NullValueHandling = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;NullValueHandling&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Ignore&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;});&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; request = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpRequestMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpMethod&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Post,&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;tableEndpoint);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;request.Content = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;StringContent&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(obj, &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Encoding&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.UTF8,&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data = client.SendAsync(request).Result;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (data.IsSuccessStatusCode)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;true&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;throw&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseException&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(data.StatusCode);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Update Operation&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The API documentation for Update record operation available from &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj677198.aspx" target="_blank"&gt;here&lt;/a&gt;. The code block below provides the implementation of HTTP Put for updating an existing record onto Windows Azure Mobile Services Table. &lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:06414e53-f23e-471f-9297-c6cc432e9aae" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;bool&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Put(T requestData, &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;int&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; id)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; request = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpRequestMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpMethod&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;PATCH&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;), &lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;tableEndpoint + id);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; obj = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JsonConvert&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.SerializeObject(requestData);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;request.Content = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;StringContent&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(obj, &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Encoding&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.UTF8, &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data = client.SendAsync(request).Result;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (data.IsSuccessStatusCode)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;true&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;throw&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseException&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(data.StatusCode);     &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Please note that Windows Azure Mobile Services used HTTP Verb “PATCH” for updating an existing record.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Delete Operation&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The API documentation for Delete record operation available from &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj710107.aspx" target="_blank"&gt;here&lt;/a&gt;. The code block below provides the implementation of HTTP Delete for deleting an existing record from the Windows Azure Mobile Services Table. &lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:22339e7e-b658-43b6-a102-a56aefbcfbba" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;void&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Delete(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;int&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; id)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; request = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpRequestMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpMethod&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Delete, &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;tableEndpoint + id.ToString());&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data = client.SendAsync(request).Result;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (!data.IsSuccessStatusCode)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;throw&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseException&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(data.StatusCode);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Query Operation&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The API documentation for Query record operation available from &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj677199.aspx" target="_blank"&gt;here&lt;/a&gt;. The code block below provides the implementation of querying all records and filtering with id value from the Windows Azure Mobile Services Table. &lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:89643fcb-85a3-4441-802e-fc074c476f43" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;lt;T&amp;gt; GetAll()&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; result = client.GetStringAsync(tableEndpoint).Result;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JsonConvert&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.DeserializeObject&amp;lt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;lt;T&amp;gt;&amp;gt;(result);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data; &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; T Get(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;int&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; id)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; result = client.GetStringAsync(tableEndpoint +&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;?$filter=Id eq &amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; + id).Result;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JsonConvert&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.DeserializeObject&amp;lt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;lt;T&amp;gt;&amp;gt;(result);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; data.FirstOrDefault();&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#000000"&gt;} &lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services supports the Open Data Protocol (OData) so that you can query the data from Windows Azure Mobile Services Table by using the query option parameters provided by the OData.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The complete implementation of the MobileServiceRequestHelper class is available on Gist at &lt;a href="https://gist.github.com/shijuvar/5562928"&gt;https://gist.github.com/shijuvar/5562928&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Consuming the REST API from ASP.NET Web API App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the previous steps, we have created a generic type helper class for executing requests against Windows Azure Mobile Services REST API. The code block below provides the HTTP Post operation of our ASP.NET Web API where we inserting a new record onto Windows Azure Mobile Services table named “tokens”&lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ee5bcd10-2f23-44da-b3b6-f941156edcc8" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 400px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Post(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Token&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; token)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (ModelState.IsValid)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; req = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;MobileServiceRequestHelper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Token&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;tokens&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; isSuccess = req.Post(token);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (isSuccess)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; response = Request.CreateResponse(&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpStatusCode&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Created, token);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; response;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;throw&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpResponseException&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpStatusCode&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.BadRequest);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Request.CreateErrorResponse(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpStatusCode&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.BadRequest, ModelState);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are creating an object of MobileServiceRequestHelper with generic type Token and inserting a new record on Windows Azure Mobile Services table “tokens”.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10276779" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/fsMOxAiiU-Q" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET+Web+API/default.aspx">ASP.NET Web API</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/05/12/consuming-windows-azure-mobile-services-rest-api-from-asp-net-web-api-app.aspx</feedburner:origLink></item><item><title>Windows Azure SDK 2.0 for .NET Released</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/duaj4OBp_AQ/windows-azure-sdk-2-0-for-net-released.aspx</link><pubDate>Wed, 01 May 2013 07:11:42 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10235290</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10235290</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10235290</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/05/01/windows-azure-sdk-2-0-for-net-released.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Windows Azure Cloud Computing platform has been in the big news after the platform exceeded the annual revenue of $1 billion. Today, Microsoft has been released the Windows Azure SDK 2.0 for .NET update that lets the .NET developers to build Windows Azure apps from Visual Studio with an easy and more elegant manner. The new update provides the lot of improvements within Visual Studio, for developing, deploying and managing Windows Azure apps. You can download and install the Windows Azure SDK 2.0 for .NET from the &lt;a href="http://www.windowsazure.com/en-us/develop/net/" target="_blank"&gt;Windows Azure .NET developer center&lt;/a&gt;. The Windows Azure SDK for .NET is a open source project hosted on &lt;a href="https://github.com/WindowsAzure/azure-sdk-for-net" target="_blank"&gt;GitHub&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/home_net_sdk_5D1F39FA.png"&gt;&lt;img title="home_net_sdk" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="home_net_sdk" src="http://weblogs.asp.net/blogs/shijuvarghese/home_net_sdk_thumb_441343E8.png" width="517" height="265" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/install_120B7D91.png"&gt;&lt;img title="install" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="install" src="http://weblogs.asp.net/blogs/shijuvarghese/install_thumb_00D79FEE.png" width="525" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Improvement in Windows Azure SDK 2.0 for .NET&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The information below provides the summary of the improvements provided by Windows Azure SDK 2.0 for .NET.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt; Windows Azure Web Sites:&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Improved tooling support in Visual Studio for publishing apps&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Management Support within the Visual Studio Server Explorer&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Enable Live Streaming of Diagnostic Logs within the Visual Studio &lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Cloud Services:&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Support for choosing High Memory VM Instances within Visual Studio&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Application Deployment Support with Simultaneous Update Option&lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Improved Diagnostics Support&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Storage:&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Table Storage Explorer within the Visual Studio Server Explore&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Service Bus&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Enhanced client library with&amp;#160; support for browsing messages, message pump programming model and auto delete for Idle messaging Entities&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure PowerShell Automation&lt;/font&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Enhanced version with new Automation Commands&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can see the detailed information on the Windows Azure SDK 2.0 for .NET from ScottGu’s blog post &lt;a href="http://weblogs.asp.net/scottgu/archive/2013/04/30/announcing-the-release-of-windows-azure-sdk-2-0-for-net.aspx" target="_blank"&gt;Announcing the release of Windows Azure SDK 2.0 for .NET&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10235290" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/duaj4OBp_AQ" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure+Storage/default.aspx">Azure Storage</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/05/01/windows-azure-sdk-2-0-for-net-released.aspx</feedburner:origLink></item><item><title>Sending and Receiving Messages in Windows Azure Storage Queue with JavaScript Serializer</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/8Sz9YQDdL90/adding-and-receiving-messages-in-windows-azure-storage-queue-with-javascript-serializer.aspx</link><pubDate>Tue, 30 Apr 2013 17:06:34 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10233233</guid><dc:creator>shiju</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10233233</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10233233</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/30/adding-and-receiving-messages-in-windows-azure-storage-queue-with-javascript-serializer.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;In this&lt;/font&gt; &lt;font face="Calibri"&gt;blog post, I will demonstrate sample code for sending and receiving messages in Windows Azure Storage Queue with JavaScript Serializer for serializing and de-serializing messages. We are adding a custom type to Windows Azure Queue where we are using JavaScriptSerializer Class provided by System.Web.Script.Serialization namespace, for the serialization.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Creating a Windows Azure Storage Queue&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below method creates a Windows Azure Storage Queue&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:63ad6e21-0752-4580-b63f-7b5b0e9adb2c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;static&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudQueue&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; GetAzureQueue(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;string&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; queueName)&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; storageAccount = Microsoft.WindowsAzure.Storage&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;.&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudStorageAccount&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Parse(&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;RoleEnvironment&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.GetConfigurationSettingValue&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;StorageConnectionString&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;));&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; queueClient = storageAccount.CreateCloudQueueClient();&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudQueue&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; queue = queueClient.GetQueueReference(queueName);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; queue;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Adding Messages to Windows Azure Storage Queue&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below code block in the ASP.NET MVC Action Method, creates a Windows Azure Storage Queue and adding messages to the Queue. For adding a custom type to the Queue, we are serialize the model as a string message using JavaScript Serializer &lt;/font&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:507603ea-abde-4f42-a50e-6b9d67ae2c6f" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#000000"&gt;[&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;HttpPost&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;]&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;public&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;ActionResult&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; Create(&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CustomerFormModel&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; form)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (ModelState.IsValid)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;//maps to domain object from view model&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; command = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Mapper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Map&amp;lt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CustomerFormModel&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;,&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;NewCustomerCommand&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;gt;(form);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; serializer = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JavaScriptSerializer&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;();&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; modelAsString = serializer.Serialize(command);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; queueClient = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;AzureStorageHelper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.GetAzureQueue(QueueName);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;queueClient.CreateIfNotExists();&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;//Add messages to the Azure Queue&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;queueClient.AddMessage(&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudQueueMessage&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;(modelAsString));               &lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; RedirectToAction(&lt;/span&gt;&lt;span style="background:#ffffff;color:#a31515"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;return&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; View(form);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Receiving Messages from Windows Azure Storage Queue&lt;/strong&gt;&lt;/font&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the implementation in a Worker Role for retrieving messages from Windows Azure Storage Queue and de-serializing the message string as a custom type. Finally, we creates a Windows Azure Table entity from the values of de-serialized type and inserting to Windows Azure Table. &lt;/font&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7b32f0b6-3445-4346-80e5-742d8908ea48" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 500px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudTable&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; customerTable = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;AzureStorageHelper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.GetAzureTable(TableName);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;customerTable.CreateIfNotExists();&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;CloudQueue&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; customerQueue = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;AzureStorageHelper&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.GetAzureQueue(QueueName);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;customerQueue.CreateIfNotExists();&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; receivedMessage=customerQueue.GetMessage();&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;if&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; (receivedMessage != &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;null&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;// Process the message&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; serializer = &lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;JavaScriptSerializer&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;();&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;var&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; command = serializer.Deserialize&amp;lt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;NewCustomerCommand&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;&amp;gt;(receivedMessage.AsString);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;// Create a new Azure Table entity.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Customer&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; customer=&lt;/span&gt;&lt;span style="background:#ffffff;color:#0000ff"&gt;new&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Customer{&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;Id=&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;Guid&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.NewGuid().ToString(),&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;PartitionKey = command.LastName,&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;RowKey = command.FirstName,&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;FirstName=command.FirstName,&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;LastName=command.LastName,&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;Address=command.Address,&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;Email=command.Email,&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="background:#ffffff;color:#000000"&gt;Phone=command.Phone                                &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;};&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;// Create the TableOperation that inserts the customer entity.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;TableOperation&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt; insertOperation = &lt;/span&gt;&lt;span style="background:#ffffff;color:#2b91af"&gt;TableOperation&lt;/span&gt;&lt;span style="background:#ffffff;color:#000000"&gt;.Insert(customer);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;&lt;/span&gt;&lt;span style="background:#ffffff;color:#008000"&gt;// Execute the insert operation.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;customerTable.Execute(insertOperation);&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="background:#ffffff;color:#000000"&gt;customerQueue.DeleteMessage(receivedMessage);&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="background:#ffffff;color:#000000"&gt;}&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10233233" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/8Sz9YQDdL90" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/30/adding-and-receiving-messages-in-windows-azure-storage-queue-with-javascript-serializer.aspx</feedburner:origLink></item><item><title>Slides and Code from My Global Windows Azure Bootcamp Presentation</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/pU2iF0SVGas/slides-and-code-from-my-global-windows-azure-bootcamp-presentation.aspx</link><pubDate>Sat, 27 Apr 2013 15:07:42 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10219948</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10219948</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10219948</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/27/slides-and-code-from-my-global-windows-azure-bootcamp-presentation.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;I did a presentation on Windows Azure Cloud Services at &lt;a href="http://globalwindowsazure.azurewebsites.net/" target="_blank"&gt;Global Windows Azure Bootcamp&lt;/a&gt; in &lt;a href="http://kochibootcamp.azurewebsites.net/" target="_blank"&gt;Kochi&lt;/a&gt;, India. The title of the session was “Windows Azure Cloud Services – Web Roles and Worker Roles”. In this session, I have demonstrated how to building multi-tier Windows Azure Cloud Services application using with Web Role, Worker Role, Table Storage and Service Bus Queue. You can download the source code from my github repository &lt;a href="https://github.com/shijuvar/AzureCloudServices"&gt;https://github.com/shijuvar/AzureCloudServices&lt;/a&gt;. The code walkthrough demonstrated in the blog post &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2013/04/22/building-windows-azure-cloud-services-app-with-web-role-worker-role-table-storage-and-service-bus.aspx" target="_blank"&gt;Building Windows Azure Cloud Services App with Web Role, Worker Role, Table Storage and Service Bus&lt;/a&gt;. The slides used for the talk can download from &lt;a href="http://www.slideshare.net/shijucv/windows-azure-cloud-services-20082884" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10219948" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/pU2iF0SVGas" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure+Storage/default.aspx">Azure Storage</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/27/slides-and-code-from-my-global-windows-azure-bootcamp-presentation.aspx</feedburner:origLink></item><item><title>Global Windows Azure Bootcamp in Kochi, Kerala</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/Y5plG43we24/global-windows-azure-bootcamp-in-kochi-kerala.aspx</link><pubDate>Thu, 25 Apr 2013 05:58:41 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10209870</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10209870</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10209870</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/25/global-windows-azure-bootcamp-in-kochi-kerala.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;On April 27, a global Windows Azure bootcamp is organizing across the world. This event is a free, one-day training program for Windows Azure and delivering variety of topics on the Cloud and Windows Azure platform. You can visit the global Windows Azure bootcamp website from &lt;a href="http://globalwindowsazure.azurewebsites.net/" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img alt="clip_image001" src="http://weblogs.asp.net/blogs/scottgu/clip_image001_6C948099.png" width="376" height="239" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In Kerala, India, global Windows Azure bootcamp is conducting at Kochi, organized by &lt;a href="http://k-mug.org/" target="_blank"&gt;Kerala Microsoft Users Group&lt;/a&gt; and sponsored by &lt;a href="http://www.marlabs.com/" target="_blank"&gt;Marlabs&lt;/a&gt; and &lt;a href="http://www.orioninc.com/" target="_blank"&gt;Orion&lt;/a&gt;. Visit the Kochi Windows Azure bootcamp website from &lt;a href="http://kochibootcamp.azurewebsites.net/" target="_blank"&gt;here&lt;/a&gt; and you can register for the event from &lt;a href="http://globalazurebootcamp.eventbrite.com/" target="_blank"&gt;here&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kochibootcamp.azurewebsites.net/" target="_blank"&gt;&lt;img src="http://kochibootcamp.azurewebsites.net/kmug-bootcamp.png?x=7" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10209870" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/Y5plG43we24" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Community+News/default.aspx">Community News</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/25/global-windows-azure-bootcamp-in-kochi-kerala.aspx</feedburner:origLink></item><item><title>Deploying Windows Azure Cloud Services Apps</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/SL3XukGowhE/deploying-windows-azure-cloud-services-apps.aspx</link><pubDate>Wed, 24 Apr 2013 13:20:36 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10206834</guid><dc:creator>shiju</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10206834</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10206834</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/24/deploying-windows-azure-cloud-services-apps.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In my previous post &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2013/04/22/building-windows-azure-cloud-services-app-with-web-role-worker-role-table-storage-and-service-bus.aspx" target="_blank"&gt;Building Windows Azure Cloud Services App with Web Role, Worker Role, Table Storage and Service Bus&lt;/a&gt;, I have demonstrated how to build a multi-tier cloud application using Windows Azure Cloud Service. In this post, I will demonstrate how to deploy our Cloud Service application on Windows Azure using Visual Studio 2012. You can create a Cloud Service from Visual Studio itself and can deploy the Cloud Service to Windows Azure without using the Windows Azure management portal. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Publishing the Cloud Service App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s publish our cloud service app from Visual Studio. Right-click the Cloud Service project, and click Publish as shown in the below picture&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/publish_7CA03343.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="publish" border="0" alt="publish" src="http://weblogs.asp.net/blogs/shijuvarghese/publish_thumb_5348EB45.png" width="421" height="229" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Publish wizard will ask you for the Windows Azure Subscription as shown in the below picture. If you have not imported any Windows Azure subscription, you can download it by clicking “Sign in to download credentials” which will download a .publishsettings file from Windows Azure management portal and later you can import the .publishsettings by clicking the Import button. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/choose_subscription_4529FC48.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="choose_subscription" border="0" alt="choose_subscription" src="http://weblogs.asp.net/blogs/shijuvarghese/choose_subscription_thumb_5B3067DA.png" width="476" height="360" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The wizard will ask you for choose a Cloud Service in the Windows Azure Publish Settings window. You can choose an existing Cloud Service which you have created from Management Portal. You can also create the Cloud Service from Visual Studio itself. Let’s create a Cloud Service from Visual Studio where you can specify the name of the service and location of the data center.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/new_cloud_service_3100B9F2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="new_cloud_service" border="0" alt="new_cloud_service" src="http://weblogs.asp.net/blogs/shijuvarghese/new_cloud_service_thumb_4DBA2F07.png" width="487" height="395" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the Windows Azure Publish Settings window, we can specify the environment, Build configuration and Service configuration. Windows Azure provides two environment for running apps: staging and production, where staging is used for testing and validating our cloud service app and production is used for running live applications.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/cloudservice_created_315CC71A.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="cloudservice_created" border="0" alt="cloudservice_created" src="http://weblogs.asp.net/blogs/shijuvarghese/cloudservice_created_thumb_75508564.png" width="490" height="381" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can also enable Remote Desktop for roles which lets access to the roles hosted on the virtual machines by using remote desktop. The screenshot below provides the Remote Desktop Window.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/remote_desktop_1209FA7A.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="remote_desktop" border="0" alt="remote_desktop" src="http://weblogs.asp.net/blogs/shijuvarghese/remote_desktop_thumb_7303D6DB.png" width="572" height="369" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The next windows in the wizard shows the summary of Windows Azure Publish configuration. We can edit these configurations in our future publish and can also modify it from Windows Azure management portal&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/publish_summary_6B2BBE6C.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="publish_summary" border="0" alt="publish_summary" src="http://weblogs.asp.net/blogs/shijuvarghese/publish_summary_thumb_1A2DFA44.png" width="545" height="398" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the Windows Azure Publish Summary window, click the publish button which will deploy the Cloud services app to Windows Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The screenshot below shows the Windows Azure Activity log that shows the success of the deployment.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/success_56964921.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="success" border="0" alt="success" src="http://weblogs.asp.net/blogs/shijuvarghese/success_thumb_2DAB3418.png" width="538" height="118" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The screenshots below provides the Windows Azure management portal where we can see that our newly created Cloud Service is running in the product environment.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_720B2557.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_6F15C0A4.png" width="740" height="318" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The screenshots below show that our application running successfully on the Windows Azure cloud&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_04AFF942.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_1D5F2085.png" width="699" height="438" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_72C33FA7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_5ADC5881.png" width="644" height="465" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, we have created a Windows Azure Cloud Service from Visual Studio and deployed the Cloud Service app on the Windows Azure VM from Visual Studio. Using Visual Studio, we can easily create and deploy cloud services without accessing the Windows Azure management portal. I will discuss more about the Cloud Services in my future blog post. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on twitter at &lt;a href="https://twitter.com/shijucv" target="_blank"&gt;@shijucv&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10206834" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/SL3XukGowhE" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/24/deploying-windows-azure-cloud-services-apps.aspx</feedburner:origLink></item><item><title>Building Windows Azure Cloud Services App with Web Role, Worker Role, Table Storage and Service Bus</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/Xtq3oMFRlkU/building-windows-azure-cloud-services-app-with-web-role-worker-role-table-storage-and-service-bus.aspx</link><pubDate>Mon, 22 Apr 2013 16:52:54 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10197142</guid><dc:creator>shiju</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10197142</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10197142</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/22/building-windows-azure-cloud-services-app-with-web-role-worker-role-table-storage-and-service-bus.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Cloud Services, provides a Platform as a Service (PaaS) offering for building multi-tier, highly scalable, reliable cloud applications on the Windows Azure Cloud platform. In this blog post, I will demonstrate how to build a multi-tier Windows Azure Cloud Services application using with Web Role, Worker Role, Table Storage and Service Bus Queue. This demo application will also demonstrates the usages of Service Bus Queue, Table Storage and how to communicate between the Web Role and Worker Role.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The source code of the demo Windows Azure Cloud Services app available on GitHub at &lt;a href="https://github.com/shijuvar/AzureCloudServices"&gt;https://github.com/shijuvar/AzureCloudServices&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;About the Demo App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Cloud Services app will have two roles: a Web Role and a Worker Role. Windows Azure Service Bus Queue will be used for communicating between the Web Role and a Worker Role. Table storage is used for the persistence of data. A user can a register a Customer entity from the Web Role where a message will be send to Windows Azure Service Bus Queue. The Worker Role will be polling the Queue messages, and finally persist the data into a Windows Azure Table storage. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following Windows Azure services will be used for the demo app:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Web Role&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Worker Role&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Table&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Service Bus&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Web Role app is built with ASP.NET MVC 4 web application and the Worker Role uses the Worker Role with Service Bus Queue template. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following NuGet packages for Windows Azure, have been used in this app&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://nuget.org/packages/Microsoft.WindowsAzure.ConfigurationManager/" target="_blank"&gt;Windows Azure Configuration Manager&lt;/a&gt; - Microsoft.WindowsAzure.ConfigurationManager&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://nuget.org/packages/WindowsAzure.Storage/" target="_blank"&gt;Windows Azure Storage&lt;/a&gt; - WindowsAzure.Storage&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://nuget.org/packages/WindowsAzure.ServiceBus/" target="_blank"&gt;Windows Azure Service Bus&lt;/a&gt; - WindowsAzure.ServiceBus&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_21EF4EB1.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_3861ED38.png" width="380" height="197" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Write Command of the App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the entity class which represents for creating a new customer entity&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; NewCustomerCommand&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FirstName { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LastName { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Address { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Phone { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Read Model of the App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the read model of the app&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Customer : TableEntity&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FirstName { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LastName { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Address { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Phone { get; set; }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this demo app, Windows Azure Table storage is used for persistence and read operations will be performed against the Table storage. The Customer class represents the Windows Azure Table entity so that it is inherited from the class TableEntity.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;&lt;font size="4"&gt;Building the Cloud Services App with Visual Studio&lt;/font&gt;&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create a Windows Azure Cloud Services projects from Visual Studio 2012. The Windows Azure Cloud Service project available from the Cloud&amp;#160; template. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_224B5BD9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_30C657FE.png" width="609" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s add ASP.NET MVC 4 Web Role and Worker Role with Service Bus Queue onto the Windows Cloud service as shown in the following picture.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_256D1DF4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_0FC2BF8A.png" width="592" height="358" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Windows Azure Cloud Service project has the two Roles: a Web Role and a Worker Role&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_3BCF96AE.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_4EA41A58.png" width="353" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;Let’s add the necessary NuGet packages to the corresponding projects. In this demo app, we are using Windows Azure Storage and Windows Azure Service Bus so that we have to add the connection string for both Windows Azure Storage and Windows Azure Service Bus. To add the connection string, right click the corresponding Role from the Roles folder of the Cloud Service project, choose properties. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_15C9C08B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_289E4435.png" width="330" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;From the properties windows, choose the settings tab, add Settings. Let’s add names StorageConnectionString and Microsoft.ServiceBus.ConnectionString for Windows Azure Storage and Service Bus. If you want to use local Storage Emulator for the development cycle, you can give the value “UseDevelopmentStorage=true” for the connection string.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image40_4557B94A.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image40_thumb_74C62816.png" width="511" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Helpers for Table Storage and Service Bus Queue&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s add helper classes for Windows Azure Table and Service Bus Queue in order to working these services.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;AzureStorageHelper.cs&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;div class="csharpcode"&gt;
    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AzureStorageHelper&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InitializeAzureTable(&lt;span class="kwrd"&gt;string&lt;/span&gt; tableName)&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    CloudTable table = GetAzureTable(tableName);&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="rem"&gt;//Create table if it doesn't exists&lt;/span&gt;&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    table.CreateIfNotExists();        &lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;}&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; CloudTable GetAzureTable(&lt;span class="kwrd"&gt;string&lt;/span&gt; tableName)&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;{&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    var storageAccount = Microsoft.WindowsAzure.Storage&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        .CloudStorageAccount.Parse(&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        RoleEnvironment.GetConfigurationSettingValue&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        (&lt;span class="str"&gt;&amp;quot;StorageConnectionString&amp;quot;&lt;/span&gt;));&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="rem"&gt;// Get table for working with tables.&lt;/span&gt;&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    var tableClient = storageAccount.CreateCloudTableClient();&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    CloudTable table = tableClient.GetTableReference(tableName);&lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; table;&lt;/pre&gt;

    &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;}       &lt;/pre&gt;

    &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;}&lt;/pre&gt;
  &lt;/div&gt;
  &lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, the method GetAzureTable returns CloudTable and the InitializeAzureTable method creates the Azure Table if it does not exists.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the helper class for working with Windows Azure Service Bus&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;ServiceBusQueueHelper.cs&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ServiceBusQueueHelper&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;//// Recommended that you cache QueueClient       &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="rem"&gt;//// rather than recreating it on every request.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; public static QueueClient CustomersQueueClient;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="rem"&gt;// The name of the queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; QueueName = &lt;span class="str"&gt;&amp;quot;CustomerQueue&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; NamespaceManager CreateNamespaceManager()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString =&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    CloudConfigurationManager.GetSetting(&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="str"&gt;&amp;quot;Microsoft.ServiceBus.ConnectionString&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    var namespaceManager = NamespaceManager.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;      CreateFromConnectionString(connectionString);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; namespaceManager;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Initialize()&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    &lt;span class="rem"&gt;// Using Http to be friendly with outbound firewalls&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    ServiceBusEnvironment.SystemConnectivity.Mode =&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        ConnectivityMode.Http;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString =&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        CloudConfigurationManager.GetSetting&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        (&lt;span class="str"&gt;&amp;quot;Microsoft.ServiceBus.ConnectionString&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    NamespaceManager namespaceManager = CreateNamespaceManager();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!(namespaceManager.QueueExists(QueueName)))&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        namespaceManager.CreateQueue(QueueName);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="rem"&gt;// Initialize the connection to Service Bus Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    CustomersQueueClient = QueueClient.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        CreateFromConnectionString(connectionString, QueueName);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below calls from Global.asax.cs for creating Table and initializing the Service Bus Queue.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;//Create Azure Table&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;AzureStorageHelper.InitializeAzureTable(&lt;span class="str"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;//Initialize Service Bus Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;ServiceBusQueueHelper.Initialize();&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Sending Messages to Service Bus Queue in Web Role App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The web role app lets the users to create Customer entity, where a message will be send to Windows Azure Service Bus Queue and the worker role will be polling the queue messages.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code bock below provides to send customer message to Windows Azure Service Bus Queue, from Create action method of CustomerController&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;[HttpPost]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Create(CustomerFormModel form)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="rem"&gt;//maps to domain object from view model&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    var command = Mapper.Map&amp;lt;CustomerFormModel,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        NewCustomerCommand&amp;gt;(form);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    var message = &lt;span class="kwrd"&gt;new&lt;/span&gt; BrokeredMessage(command);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="rem"&gt;// Send customer message to Service Bus Queue          &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    ServiceBusQueueHelper.CustomersQueueClient.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;                     Send(message);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; RedirectToAction(&lt;span class="str"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; View(form);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We create the object of BrokeredMessage with the NewCustomerCommand object and send the message to Windows Azure Queue. BrokeredMessage&amp;#160; represents the unit of communication between Service Bus clients.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The screen shot below provides the UI for creating a new Customer&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_3E9489FA.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_1C5C7E74.png" width="457" height="424" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Receiving Messages from Service Bus Queue in Worker Role App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Worker Role app will be polling on the Windows Azure Service Bus Queue and persist data into Table storage. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the implementation of Worker Role&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WorkerRole : RoleEntryPoint&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;// The name of your queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; QueueName = &lt;span class="str"&gt;&amp;quot;CustomerQueue&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; QueueClient Client;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;bool&lt;/span&gt; IsStopped;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Run()&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;var storageAccount = CloudStorageAccount.Parse&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;   (RoleEnvironment.GetConfigurationSettingValue&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;   (&lt;span class="str"&gt;&amp;quot;StorageConnectionString&amp;quot;&lt;/span&gt;));       &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;while&lt;/span&gt; (!IsStopped)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="rem"&gt;// Receive the message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    BrokeredMessage receivedMessage = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    receivedMessage = Client.Receive();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (receivedMessage != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    &lt;span class="rem"&gt;// Process the message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    Trace.WriteLine(&lt;span class="str"&gt;&amp;quot;Processing&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        receivedMessage.SequenceNumber.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    NewCustomerCommand command = receivedMessage.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        GetBody&amp;lt;NewCustomerCommand&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;   &lt;span class="rem"&gt;// Create the table client.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;   CloudTableClient tableClient = storageAccount.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;       CreateCloudTableClient();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create the CloudTable object for &amp;quot;Customer&amp;quot; table.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    CloudTable table = tableClient.GetTableReference(&lt;span class="str"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create a new customer entity.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    Customer customer=&lt;span class="kwrd"&gt;new&lt;/span&gt; Customer{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;        Id=Guid.NewGuid().ToString(),&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        PartitionKey = command.LastName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        RowKey = command.FirstName,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        FirstName=command.FirstName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        LastName=command.LastName,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        Address=command.Address,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;        Email=command.Email,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;        Phone=command.Phone                                &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create the TableOperation that inserts the customer entity.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    TableOperation insertOperation = TableOperation.Insert(customer);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    &lt;span class="rem"&gt;// Execute the insert operation.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    table.Execute(insertOperation);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    receivedMessage.Complete();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;  }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (MessagingException e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!e.IsTransient)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;                Trace.WriteLine(e.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;                &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;            Thread.Sleep(10000);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (OperationCanceledException e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!IsStopped)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;                Trace.WriteLine(e.Message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;                &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; OnStart()&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;    &lt;span class="rem"&gt;// Set the maximum number of concurrent connections &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;    ServicePointManager.DefaultConnectionLimit = 12;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create the queue if it does not exist already&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = CloudConfigurationManager.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;        GetSetting(&lt;span class="str"&gt;&amp;quot;Microsoft.ServiceBus.ConnectionString&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;    var namespaceManager = NamespaceManager.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;        CreateFromConnectionString(connectionString);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!namespaceManager.QueueExists(QueueName))&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;        namespaceManager.CreateQueue(QueueName);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;    &lt;span class="rem"&gt;// Initialize the connection to Service Bus Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;    Client = QueueClient.CreateFromConnectionString&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;        (connectionString, QueueName);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;    IsStopped = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  97:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.OnStart();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  98:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  99:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 100:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnStop()&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 101:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 102:  &lt;/span&gt;    &lt;span class="rem"&gt;// Close the connection to Service Bus Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 103:  &lt;/span&gt;    IsStopped = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 104:  &lt;/span&gt;    Client.Close();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 105:  &lt;/span&gt;    &lt;span class="kwrd"&gt;base&lt;/span&gt;.OnStop();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt; 106:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 107:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Receives Messages from Queue&lt;/strong&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below receives message from Service Bus Queue&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;BrokeredMessage receivedMessage = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    receivedMessage = Client.Receive();&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Process Queue Message and Insert Data to Windows Azure Table&lt;/strong&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below processes the queue message and insert data to Windows Azure Table&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (receivedMessage != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt;// Process the message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;Trace.WriteLine(&lt;span class="str"&gt;&amp;quot;Processing&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    receivedMessage.SequenceNumber.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;NewCustomerCommand command = receivedMessage.&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    GetBody&amp;lt;NewCustomerCommand&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="rem"&gt;// Create the table client.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;CloudTableClient tableClient = storageAccount.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    CreateCloudTableClient();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="rem"&gt;// Create the CloudTable object for &amp;quot;Customer&amp;quot; table.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;CloudTable table = tableClient.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    GetTableReference(&lt;span class="str"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create a new customer entity.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    Customer customer=&lt;span class="kwrd"&gt;new&lt;/span&gt; Customer{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        Id=Guid.NewGuid().ToString(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        PartitionKey = command.LastName,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        RowKey = command.FirstName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        FirstName=command.FirstName,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        LastName=command.LastName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        Address=command.Address,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        Email=command.Email,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        Phone=command.Phone                                &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&lt;span class="rem"&gt;// Create the TableOperation that inserts the customer entity.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:&lt;/span&gt;TableOperation insertOperation = TableOperation.Insert(customer);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&lt;span class="rem"&gt;// Execute the insert operation.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;table.Execute(insertOperation);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;receivedMessage.Complete();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The messages in the Service Bus Queue contains the type NewCustomerCommand so that we are receiving the message from Queue as type NewCustomerCommand by using the generic type method GetBody of the BrokeredMessage class. The BrokeredMessage class represents the unit of communication between Service Bus clients. We create an instance of Customer object by copying the value of NewCustomerCommand object for insert a new Table entity. We create a TableOperation insert using the Insert method of TableOperation class and finally executes the insert operation using the execute method of CloudTable.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Reading Data from Windows Azure Table in Web Role App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the implementation of Index action method in the CustomerController of Web Role app.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;CloudTable table = AzureStorageHelper.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    GetAzureTable(&lt;span class="str"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;);         &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;TableQuery&amp;lt;Customer&amp;gt; query = &lt;span class="kwrd"&gt;new&lt;/span&gt; TableQuery&amp;lt;Customer&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;var customers = table.ExecuteQuery(query);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (Request.IsAjaxRequest())&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; PartialView(&lt;span class="str"&gt;&amp;quot;_List&amp;quot;&lt;/span&gt;, customers);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; View(customers);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are query the all customer data from the Windows Azure Table named Customer. We use the ExecuteQuery method of the CloudTable object for executing the query against the Table storage.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the complete implementation of ASP.NET MVC Controller class CustomerController, which is used for sending messages to Windows Azure Queue and reading data from Windows Azure Table Storage.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CustomerController : Controller&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{  &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;CloudTable table = AzureStorageHelper.&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    GetAzureTable(&lt;span class="str"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;);         &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;TableQuery&amp;lt;Customer&amp;gt; query = &lt;span class="kwrd"&gt;new&lt;/span&gt; TableQuery&amp;lt;Customer&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;var customers = table.ExecuteQuery(query);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (Request.IsAjaxRequest())&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; PartialView(&lt;span class="str"&gt;&amp;quot;_List&amp;quot;&lt;/span&gt;, customers);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; View(customers);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ViewResult Create()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    var viewModel = &lt;span class="kwrd"&gt;new&lt;/span&gt; CustomerFormModel();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; View(viewModel);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;[HttpPost]&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Create(CustomerFormModel form)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    &lt;span class="rem"&gt;//maps to domain object from view model&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    var command = Mapper.Map&amp;lt;CustomerFormModel,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        NewCustomerCommand&amp;gt;(form);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    var message = &lt;span class="kwrd"&gt;new&lt;/span&gt; BrokeredMessage(command);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="rem"&gt;// Send customer message to Service Bus Queue          &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    ServiceBusQueueHelper.CustomersQueueClient.Send(message);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; RedirectToAction(&lt;span class="str"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; View(form);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The source code of the Windows Azure Cloud Service app available on GitHub at &lt;a href="https://github.com/shijuvar/AzureCloudServices"&gt;https://github.com/shijuvar/AzureCloudServices&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;font size="4" face="Calibri"&gt;Segregation of Command and Query Operations&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We have segregated the Command and Read operations in this demo app. A Command operation from a Web Role application, sends messages to Service Bus Queue and the process of the command operations handles from a Worker Role app. The Worker Role application process the queue messages and finally persists on the Table storage for the Read operations. We use the Table storage for Read model of the app. We can use Table storage as the Read model for building CQRS applications on the Windows Azure.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this blog post, we have discussed about how to build multi-tier Windows Azure Cloud Services application using&amp;#160; Web Role, Worker Role, Service Bus Queue and Table storage. Windows Azure Cloud Services is the Windows Azure offerings for Platform as a Service (PaaS) which lets the Cloud developers to build multi-tier highly scalable, reliable cloud applications on the Windows Azure Cloud platform. We can use Windows Azure Service Bus Queue or Storage Queue for communicating between Web Roles and Worker Roles. In this demo app, we have used Service Bus Queue for communicating between Web Roles and Worker Roles.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10197142" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/Xtq3oMFRlkU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET+MVC+4/default.aspx">ASP.NET MVC 4</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/CQRS/default.aspx">CQRS</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure+Storage/default.aspx">Azure Storage</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/22/building-windows-azure-cloud-services-app-with-web-role-worker-role-table-storage-and-service-bus.aspx</feedburner:origLink></item><item><title>Using async/await with Windows Azure Service Bus Client SDK</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/SjysjMgyxhk/using-async-await-with-windows-azure-service-bus-client-sdk.aspx</link><pubDate>Sat, 13 Apr 2013 03:50:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10147089</guid><dc:creator>shiju</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10147089</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10147089</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/12/using-async-await-with-windows-azure-service-bus-client-sdk.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Windows Azure team has recently released &lt;a href="http://nuget.org/packages/WindowsAzure.ServiceBus/2.0.0-beta" target="_blank"&gt;Windows Azure Service Bus 2.0.0-beta&lt;/a&gt; which lets the Windows Azure developers to use &lt;a href="http://msdn.microsoft.com/en-in/library/system.threading.tasks.task.aspx" target="_blank"&gt;Task&lt;/a&gt; based&amp;#160; asynchronous operations while working with Windows Azure Service Bus. Now the Windows Windows Azure Service Bus SDK provides Async version for the Service Bus methods. The SDK will be working with both Visual Studio 2010 and Visual Studio 2012 as the SDK compiled against .Net Framework 4.0.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Using async/await with Windows Azure Service Bus&lt;/strong&gt;&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can add the beta version of Azure Service Bus SDK using &lt;a href="http://nuget.org/packages/WindowsAzure.ServiceBus/2.0.0-beta" target="_blank"&gt;NuGet&lt;/a&gt;. Since the updated Service Bus SDK is just reached Beta, you have to specify the “Include Prerelease” option in the Manage NuGet windows as shown in the following picture.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_11FEF3E2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_65B24730.png" width="618" height="487" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following code block shows the usage of aync/await with Service Bus Queue operations. &lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; async Task&amp;lt;QueueClient&amp;gt; GetQueueClientAsync ()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{      &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    QueueClient client;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString =&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        CloudConfigurationManager.GetSetting(&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="str"&gt;&amp;quot;Microsoft.ServiceBus.ConnectionString&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    NamespaceManager namespaceManager = CreateNamespaceManager();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="rem"&gt;//Create the queue if it does not exists&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!(await namespaceManager.QueueExistsAsync(QueueName)))&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        await namespaceManager.CreateQueueAsync(QueueName);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    }          &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="rem"&gt;// Initialize the connection to Service Bus Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    client = QueueClient.CreateFromConnectionString&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        (connectionString, QueueName);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; client;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In above code block, we are using async operations of QueueExists method and CreateQueue methods along with the await keyword. In the below code block, we are calling the above GetQueueClientAsync method and asynchronously sending&amp;#160; messages to Service Bus Queue. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; async Task&amp;lt;ActionResult&amp;gt; Submit(OnlineOrder order)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="rem"&gt;// Create a message from the order&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    var message = &lt;span class="kwrd"&gt;new&lt;/span&gt; BrokeredMessage(order);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="rem"&gt;// Getting the Queue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    QueueClient queueClient =&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        await QueueConnector.GetQueueClientAsync();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="rem"&gt;// Submit the order&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    await queueClient.SendAsync(message);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; RedirectToAction(&lt;span class="str"&gt;&amp;quot;Submit&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; View(order);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The messages retrieving from Service Bus Queue as shown in the code block provided below.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;// Receive the message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;BrokeredMessage receivedMessage = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;receivedMessage =await Client.ReceiveAsync();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (receivedMessage != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="rem"&gt;// Process the message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    Trace.WriteLine(&lt;span class="str"&gt;&amp;quot;Processing&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        receivedMessage.SequenceNumber.ToString());   &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;// View the message as an OnlineOrder&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    OnlineOrder order = receivedMessage.GetBody&amp;lt;OnlineOrder&amp;gt;();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    Trace.WriteLine(order.Customer + &lt;span class="str"&gt;&amp;quot;: &amp;quot;&lt;/span&gt; + &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        order.Product, &lt;span class="str"&gt;&amp;quot;ProcessingMessage&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    await receivedMessage.CompleteAsync();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10147089" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/SjysjMgyxhk" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/12/using-async-await-with-windows-azure-service-bus-client-sdk.aspx</feedburner:origLink></item><item><title>Creating and Deploying Windows Azure Web Sites with Microsoft WebMatrix 3</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/fx79Df40e80/creating-and-deploying-windows-azure-web-sites-with-microsoft-webmatrix-3.aspx</link><pubDate>Thu, 04 Apr 2013 04:08:12 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:10092129</guid><dc:creator>shiju</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=10092129</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=10092129</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/04/04/creating-and-deploying-windows-azure-web-sites-with-microsoft-webmatrix-3.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Microsoft WebMatrix is a free, lightweight and cloud-connected web development tool which can be used for building and deploying Windows Azure Web Sites. &lt;font size="3" face="Calibri"&gt;Microsoft WebMatrix supports ASP.NET, Node.js and PHP.&lt;/font&gt; A while ago I have written a post&amp;#160; &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2013/01/04/building-and-deploying-windows-azure-web-site-with-node-js-and-mongodb-by-using-microsoft-webmatrix.aspx" target="_blank"&gt;Building and Deploying Windows Azure Web Site with Node.js and MongoDB by using Microsoft WebMatrix&lt;/a&gt;, where I have demonstrated how we can develop and deploy Web Sites to Windows Azure. The newly released WebMatrix 3 is an excellent IDE for building and deploying Web Sites to Windows Azure. The WebMatrix 3 lets the developers to create Windows Azure Web Sites from the IDE itself and can easily publish to Windows Azure, without using Windows Azure management portal. You can add Windows Azure accounts to WebMatrix 3 and can easily create and deploy Windows Azure Web Sites using WebMatrix 3. WebMatrix 3 provides better supports for working with Windows Azure and source control integration with Git and TFS. The source control integration is a new feature to WebMatrix.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Download Microsoft WebMatrix 3&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The new version of Microsoft WebMatrix can download from &lt;a href="http://www.microsoft.com/web/webmatrix/next/"&gt;http://www.microsoft.com/web/webmatrix/next/&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Add Microsoft Account to WebMatrix 3&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can add an Account including a Microsoft Account to WebMatrix 3, which can be used for managing web sites with Windows Azure. To add an account to WebMatrix, click the Sign in button or Add Account from the top right corner of WebMatrix Quick Start window. This will prompt the following dialog where we can use either sign in using a Microsoft account for Windows Azure or we can import an account, we downloaded from a hosting provider. We can use Windows Azure Management credentials (.publishsettings file) to import an account.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_190B63E2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_76672566.png" width="550" height="313" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;I have chosen Sign in using Microsoft Account where we can use our Windows Azure account credentials.&amp;#160; Sign in using Windows Azure account will import the Windows Azure account management credentials to your WebMatrix IDE so that you can easily create and publish web sites to Windows Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_138CCD71.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_772F6583.png" width="625" height="379" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Create a Windows Azure Web Site in WebMatrix 3&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create a sample web site in WebMatrix from a Site template. For this sample, let’s create a site from Site template as shown in the following picture.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_53B2C11E.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_30361CB9.png" width="604" height="422" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;This will prompt you to create a Windows Azure Web Site where you can specify the web site name and the Windows Azure data center region as shown in the following picture. &lt;font size="3" face="Calibri"&gt;This wizard will create a web site in Windows Azure&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_5AC1D7C9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_63623055.png" width="617" height="405" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_15795AD3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_3A96A53F.png" width="611" height="48" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Publish Web Sites to Windows Azure&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can easily publish the web site contents by just clicking the publish button of WebMatrix whenever we want publish our contents. The publish option will prompt the publish compatibility for the publishing of first time and finally preview the contents to be uploaded to Windows Azure. For the later uploads, it will just prompt the Publish Preview windows. The following screenshots shows Publish Compatibility and Publish Preview windows.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_425E97E1.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_14FD0211.png" width="634" height="459" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_1D3127A8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_08CB621D.png" width="639" height="428" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_05D5FD6A.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_02E098B7.png" width="650" height="430" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following screenshot shows that the Windows Azure web site is running successfully after the publish web site to Windows Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_5844B7D9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_422E267A.png" width="657" height="373" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=10092129" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/fx79Df40e80" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/04/04/creating-and-deploying-windows-azure-web-sites-with-microsoft-webmatrix-3.aspx</feedburner:origLink></item><item><title>Generating Entity Data Model Diagram from EF Code First DbContext</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/-O9Wn8ScGuk/generating-entity-data-model-diagram-from-ef-code-first-dbcontext.aspx</link><pubDate>Sun, 03 Mar 2013 07:58:17 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:9937227</guid><dc:creator>shiju</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=9937227</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=9937227</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/03/03/generating-entity-data-model-diagram-from-ef-code-first-dbcontext.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Entity Framework Code First approach lets the developers to build applications with Domain-Driven Design (DDD) by hand coding your Persistence Ignorance (PI) classes. At the same time, it would be great if we could see the entity model in a visual diagram, which can also ensure that our domain model is accurate and our relationships are designed properly. The &lt;a href="http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d" target="_blank"&gt;Entity Framework Power Tools&lt;/a&gt; lets you to view a&amp;#160; read-only view of the Code First model in the Entity Model Designer, from a Code First DbContext class. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can add the Entity Framework Power Tools from Visual Studio 2012. To install Entity Framework Power Tools from Visual Studio 2012, select the Extensions and Updates from the Tools menu and search for Entity Framework Power Tools in the Visual Studio online gallery, and install the Power Tools. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_466E568C.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_01FE3F80.png" width="642" height="410" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;One you have installed the Entity Framework Power Tools, you can see a context menu Entity Framework. To generate a read-only Entity Model in a designer, select the Code First DbConext class and right click, from the Entity Framework context menu, select view Entity Data Model (Read-only) as shown in the below picture:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4D6D476A.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_6A92EF74.png" width="554" height="461" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following screen shot shows the Entity Data Model generated from my Codeplex project &lt;a href="http://efmvc.codeplex.com/" target="_blank"&gt;EFMVC&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_3073FCC8.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_09593D86.png" width="554" height="647" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Please note that this is a read-only model which won’t allow to edit the model in the designer. By looking on the Data Model in the designer, you can verify that the domain model is correct and relationships are configured properly.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=9937227" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/-O9Wn8ScGuk" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/03/03/generating-entity-data-model-diagram-from-ef-code-first-dbcontext.aspx</feedburner:origLink></item><item><title>Demo app and eBook for Windows Azure Mobile Services for iOS Clients</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/porNh-Mu9_E/demo-app-and-ebook-for-windows-azure-mobile-services-for-ios-clients.aspx</link><pubDate>Fri, 22 Feb 2013 09:53:12 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:9900796</guid><dc:creator>shiju</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=9900796</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=9900796</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/02/22/demo-app-and-ebook-for-windows-azure-mobile-services-for-ios-clients.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Mobile Cloud and Windows Azure Mobile Services&lt;/strong&gt;&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The key advantage of the Cloud computing is the salability power and the business agility where you don't have to worry about your infrastructure and you can focus on your apps which can easily scale up and scale down the number of compute resources based on your scalability needs. It would be great if we could use the power and agility of Cloud computing to Mobile apps which can also be a solution to the lack of local resources in Mobile devices. The Mobile Cloud Computing is emerging as one of the most important extension of cloud computing, where both the data storage and the data processing will be happen in Cloud infrastructure instead of the mobile devices and on-premises servers. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Microsoft Windows Azure extends their Cloud computing offerings to Mobile devices which let you to build powerful Mobile apps that can utilize the power and scalability of Cloud computing. Windows Azure Mobile Services provides structured storage, user authentication and push notifications to iOS, Android, Windows Phone and Windows Store apps. You can use Windows Azure Mobile Services as the backend infrastructure for your mobile apps where you can enjoy the all power of Cloud computing to your Mobile apps which can easily scale up when users of the apps are increasing. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;&lt;font size="4"&gt;Demo app and eBook for Windows Azure Mobile Services for iOS Clients&lt;/font&gt;&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In my organization &lt;a href="http://www.marlabs.com/" target="_blank"&gt;Marlabs&lt;/a&gt;, our Windows Azure team has been working on few sample apps for Windows Azure Mobile Services. You can download an initial drop of a sample Windows Azure Mobile Services app for iOS Clients, which including a eBook, which demonstrates how to leverage Windows Azure Mobile Services for the sample iOS app.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can download the sample app and eBook from &lt;a title="http://azuremobileios.codeplex.com/" href="http://azuremobileios.codeplex.com/"&gt;http://azuremobileios.codeplex.com/&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.marlabs.com/" target="_blank"&gt;&lt;img alt="Marlabs" src="http://www.marlabs.com/sites/default/files/logo.png" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://www.windowsazure.com/en-us/home/scenarios/mobile-services/" target="_blank"&gt;&lt;img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRzCncHdYzBjcTdOaa_vzNj6i7W5p2lCexHQYdF9KLLsV39wjjw" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=9900796" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/porNh-Mu9_E" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Mobile/default.aspx">Mobile</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/02/22/demo-app-and-ebook-for-windows-azure-mobile-services-for-ios-clients.aspx</feedburner:origLink></item><item><title>Automating Windows Azure with Windows Azure CLI</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/0KEqSnuiSAY/automating-windows-azure-with-windows-azure-cli.aspx</link><pubDate>Fri, 25 Jan 2013 06:17:42 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:9797263</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=9797263</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=9797263</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/01/25/automating-windows-azure-with-windows-azure-cli.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Recently, Microsoft Windows Azure team has announced the release of azure-cli 0.6.10 which can be used for automating Windows Azure in an easy and elegant manner. The azure-cli is a Node.js based cross platform command line tool for Windows Azure, which can be used for managing and deploying Windows Azure Websites, Windows Azure Storage, Mobile Services, Virtual Machines, Service Bus from command prompt on Windows, Mac and Linux. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Installing Windows Azure CLI&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can install Windows Azure CLI by either using a MSI installer for Windows or using a Node.js NPM module azure-cli. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;The Windows installer can download from &lt;a href="http://go.microsoft.com/fwlink/?LinkID=275464&amp;amp;clcid=0x409" target="_blank"&gt;here&lt;/a&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_62B92F39.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_51F1848B.png" width="479" height="331" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI is a Node.js based command line tool, so the Windows installer for Azure CLI&amp;#160; will automatically install Node.js and other required components.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Azure CLI is delivering as a Node.js NPM module so that we can install the Azure CLI using Node.js. The following command will install Azure CLI&amp;#160; by using Node.js Package Manager.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_63816F56.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_1A7B4D90.png" width="391" height="77" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above command, we install NPM module azure-cli&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Using Windows Azure CLI&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;After installing Azure CLI, just type azure and enter in the command prompt that will show the following output which including all available commands&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_380D288F.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_233B300F.png" width="592" height="448" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The information provided below is a few sample commands for automating Windows Azure with Azure CLI&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Managing Windows Azure Accounts&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure account download” will download a publishsettings file from Windows Azure portal. You have to login to the Windows Azure portal in order to download the publishsettings file. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_5FA37EEC.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_28E623E8.png" width="493" height="107" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure account import [publishsettings file] imports Windows Azure credentials so that you can easily manage Windows Azure Websites, Mobile Services, Virtual Machines, Service Bus by using the CLI commands.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_0641E56D.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_6409D9E6.png" width="573" height="190" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Managing Windows Azure Storage&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI&amp;#160; command “azure account storage list” list out the all storage account&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_59F538BB.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_74552BD2.png" width="526" height="90" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI&amp;#160; command “azure account storage create [name] --location [&amp;quot;location&amp;quot;]” creates a storage account in the specified location.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4AFDE3D4.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_3B7AD205.png" width="571" height="77" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure account storage delete [name]” removes the specified storage account&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4010DCBF.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_3E6010EB.png" width="426" height="76" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Managing Windows Azure Websites&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure site list” list out the websites created in the Windows Azure account.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_29FA4B60.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_48648C49.png" width="435" height="125" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure site create [name]” creates a Website in the specified data center region. The below&lt;/font&gt;&lt;font size="3" face="Calibri"&gt; command creates a Website in West US region.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_0CC47D89.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_4ADD983A.png" width="434" height="143" /&gt;&lt;/a&gt;&lt;/p&gt;              &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure site show [name]” shows the all details about the specified Azure Website&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4C5EB44E.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_05951B44.png" width="596" height="456" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI command “azure site delete [name]” removes the specified Windows Azure Website&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_0CF0DAF1.png"&gt;&lt;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="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_404C9E4D.png" width="442" height="111" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;More Information on Azure CLI&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;For more details on the commands and reference on Azure CLI, check out the following links:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.windowsazure.com/en-us/manage/linux/other-resources/command-line-tools/" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure command-line tool for Mac and Linux&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.windowsazure.com/en-us/manage/linux/other-resources/command-line-tools/" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;How to use the Windows Azure Command-Line Tools&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/windowsazure/archive/2012/12/19/azure-cli-0-6-9-ships-pure-joy.aspx" target="_blank"&gt;azure-cli 0.6.9 ships, pure joy&lt;/a&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://codebetter.com/glennblock/2012/12/25/simple-bash-scripting-for-azure-cli/" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;Simple bash scripting for “azure” cli&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://codebetter.com/glennblock/2013/01/19/teach-your-website-new-deployment-tricks-with-azure-cli-1-of-xxx-running-mocha-tests/" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;Teach your Azure Website new deployment tricks with azure-cli 1 of XXX: Running Mocha Tests&lt;/font&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Azure CLI is a great command line tool which lets Windows Azure developers to automate Windows Azure by using your favorite command line tools regardless of operating systems. By using Windows Azure CLI, we can manage and deploy Windows Azure Websites, Windows Azure Storage, Mobile Services, Virtual Machines, Service Bus from command prompt on Windows, Mac and Linux. &lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=9797263" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/0KEqSnuiSAY" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/01/25/automating-windows-azure-with-windows-azure-cli.aspx</feedburner:origLink></item><item><title>Building and Deploying Windows Azure Web Site with Node.js and MongoDB by using Microsoft WebMatrix</title><link>http://feedproxy.google.com/~r/ShijuVBlog/~3/9yOFjeljVsg/building-and-deploying-windows-azure-web-site-with-node-js-and-mongodb-by-using-microsoft-webmatrix.aspx</link><pubDate>Fri, 04 Jan 2013 06:34:37 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:9697425</guid><dc:creator>shiju</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://weblogs.asp.net/shijuvarghese/rsscomments.aspx?PostID=9697425</wfw:commentRss><wfw:comment>http://weblogs.asp.net/shijuvarghese/commentapi.aspx?PostID=9697425</wfw:comment><comments>http://weblogs.asp.net/shijuvarghese/archive/2013/01/04/building-and-deploying-windows-azure-web-site-with-node-js-and-mongodb-by-using-microsoft-webmatrix.aspx#comments</comments><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this blog post, I will demonstrate how to build a web app with Node.js and MongoDB, and will deploy it on Windows Azure as a Windows Azure Web Site. Firstly, I will create a web site with Node.js, Express.js, Mongoose and MongoDB. Then I will create a MongoDB database on MongoLab, which is a MongoDB as a service hosted on Cloud, and finally deploy the web app to Windows Azure Web Site. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;The source code for the demo app is available on Github at &lt;a title="https://github.com/shijuvar/NodeExpressMongo" href="https://github.com/shijuvar/NodeExpressMongo"&gt;https://github.com/shijuvar/NodeExpressMongo&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;About the Demo Web App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;This is a simple Task management application which provide the functionality for add, edit, delete and list out the Tasks. The home page will list out the uncompleted&amp;#160; Tasks and List page will list out all tasks. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Node.js modules for the web app&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following NPM modules will be used for this demo web app.&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Express.js – A light-weight web application framework for Node.js&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Mongoose - MongoDB object modeling framework for node.js&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Jade – A server-side view engine for Node.js web apps, which will be used with Express application&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Creating the web app with Microsoft WebMatrix IDE&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create a Node.js Express web app from the Microsoft WebMatrix IDE by using the Express site template&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_723600FF.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_28C3AC44.png" width="658" height="454" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;The express template will create a basic Express site with necessary configuration for IISNode and will add the NPM modules Express and Jade.&lt;/font&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Adding NPM Modules using WebMatrix&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;WebMatrix is providing an extension “NPM Gallery” which can be used for installing NPM modules from the &lt;font size="3"&gt;WebMatrix &lt;/font&gt;. You can install this extension from the extension gallery as shown in the below picture &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4D0890C6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_18F3F173.png" width="561" height="194" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;After adding the NPM Gallery, We can see the NPM Gallery extension icon on the top of the WebMatrix IDE&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_56A0D92F.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_750B1A18.png" width="383" height="106" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can easily find and install NPM modules by using the NPM Gallery. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_64AFA25F.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_6945AD19.png" width="527" height="422" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Express template provided by WebMatrix will automatically add the NPM modules Express and Jade. In our app, we will be use NPM module Mongoose so that we have to install Mongoose module from the NPM gallery.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt; &lt;font face="Calibri"&gt;&lt;font size="3"&gt;&lt;strong&gt;Structure of the web app&lt;/strong&gt;&lt;/font&gt; &lt;/font&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The web app will be structured as the following project structure. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_066B5524.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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://weblogs.asp.net/blogs/shijuvarghese/image_thumb_0B6D92D3.png" width="298" height="471" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The details for the application folders and files are provided below:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;server.js – Entry point of the web app&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;routes.js – Specified the routes for web app&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;controllers – Controller classes which handles user interactions. The logic for the CRUD operations also implemented in the controller classes &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;models – Model of the app. The model schema defined with Mongoose&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;public – Static contents of the web app&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;views – View templates built with Jade &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;config.js – Configuration file used for specifying the connection string for MongoDB&lt;/font&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;web.config - Configuration file for the IISNode&lt;/font&gt;&lt;font size="3"&gt;&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Model for the web app&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create the model with Mongoose for the demo web app. Mongoose is a schema based MongoDB object modeling framework for node.js. The model for the web app is provided in the below function:&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; models(&lt;span class="kwrd"&gt;params&lt;/span&gt;) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; mongoose = &lt;span class="kwrd"&gt;params&lt;/span&gt;.mongoose;    &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="rem"&gt;/* Schema Definition */&lt;/span&gt;    &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; Task = &lt;span class="kwrd"&gt;new&lt;/span&gt; Schema({&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    name        :  { type: String, required: &lt;span class="kwrd"&gt;true&lt;/span&gt; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;  , description : String&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  , status      : String&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;  , startDate   : { type: Date, &lt;span class="kwrd"&gt;default&lt;/span&gt;: Date.now }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;  , dueDate     : Date&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;  , completion  : {type: Number, &lt;span class="kwrd"&gt;default&lt;/span&gt;: 0}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;mongoose.model(&lt;span class="str"&gt;'Tasks'&lt;/span&gt;, Task);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;};&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;module.exports = models;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;














.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The application is a simple task management application and the above schema definition contains the information for the MongoDB collection Tasks. The Mongoose object will be passed from the main entry of the app.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Server.js – Entry point of the web app&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The server.js is the entry point of the web app and the implementation is given below: &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;/**&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="rem"&gt; * Module dependencies.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt; */&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="rem"&gt;//MPM Modules&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; express = require(&lt;span class="str"&gt;'express'&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;  , mongoose = require(&lt;span class="str"&gt;'mongoose'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; config = require(&lt;span class="str"&gt;'./config.js'&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;   , routes = require(&lt;span class="str"&gt;'./routes.js'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;mongoose.connect(config.db.mongodb);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; models = require(&lt;span class="str"&gt;'./models'&lt;/span&gt;)({ mongoose: mongoose });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; controllers = require(&lt;span class="str"&gt;'./controllers'&lt;/span&gt;)(&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;{mongoose: mongoose});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; app =  express.createServer();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&lt;span class="rem"&gt;// Configuration&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;app.configure(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;  app.set(&lt;span class="str"&gt;'views'&lt;/span&gt;, __dirname + &lt;span class="str"&gt;'/views'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;  app.set(&lt;span class="str"&gt;'view engine'&lt;/span&gt;, &lt;span class="str"&gt;'jade'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;  app.use(express.bodyParser());&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;  app.use(express.methodOverride());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;  app.use(app.router);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;  app.use(express.&lt;span class="kwrd"&gt;static&lt;/span&gt;(__dirname + &lt;span class="str"&gt;'/public'&lt;/span&gt;));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;app.configure(&lt;span class="str"&gt;'development'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;  app.use(express.errorHandler({ dumpExceptions: &lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;showStack: &lt;span class="kwrd"&gt;true&lt;/span&gt; }));&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;});&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;app.configure(&lt;span class="str"&gt;'production'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;  app.use(express.errorHandler());&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;});&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&lt;span class="rem"&gt;// Routes&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;routes.setup({&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    controllers: controllers,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    app: app&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;});&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;app.listen(process.env.port || 3000);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class="csharpcode"&gt;&amp;#160;&lt;/div&gt;
&lt;style type="text/css"&gt;














.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;div class="csharpcode"&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/div&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Routes of the web app&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following function will specify the routes for the web app&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;exports.setup = &lt;span class="kwrd"&gt;function&lt;/span&gt;(&lt;span class="kwrd"&gt;params&lt;/span&gt;) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; app = &lt;span class="kwrd"&gt;params&lt;/span&gt;.app;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; controllers = &lt;span class="kwrd"&gt;params&lt;/span&gt;.controllers;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="rem"&gt;// Routes for Tasks&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    app.get(&lt;span class="str"&gt;'/'&lt;/span&gt;, controllers.index);   &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    app.get(&lt;span class="str"&gt;'/tasks/list'&lt;/span&gt;, controllers.list);   &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    app.get(&lt;span class="str"&gt;'/tasks/add'&lt;/span&gt;, controllers.newTask);   &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    app.post(&lt;span class="str"&gt;'/tasks/addTask'&lt;/span&gt;, controllers.addTask);   &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    app.get(&lt;span class="str"&gt;'/tasks/edit/:id'&lt;/span&gt;, controllers.editTask);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    app.post(&lt;span class="str"&gt;'/tasks/updateTask'&lt;/span&gt;, controllers.updateTask);  &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    app.get(&lt;span class="str"&gt;'/tasks/delete/:id'&lt;/span&gt;, controllers.deleteTask); &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;For each routes, we have called corresponding function of the controller class.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Controller – Handles user interactions&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The controller class handles the all user interactions and renders corresponding view templates for each user request. The logic for the CRUD operations are also specified in the controller class. The controller class for the Task management is provided below:&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/div&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; controllers(&lt;span class="kwrd"&gt;params&lt;/span&gt;) {    &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; mongoose = &lt;span class="kwrd"&gt;params&lt;/span&gt;.mongoose;      &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; Tasks = mongoose.model(&lt;span class="str"&gt;'Tasks'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    controllers.index = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) {  &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;       Tasks.find({}).nor([{ status: &lt;span class="str"&gt;'Completed'&lt;/span&gt; }, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;                { completion: 100 }])&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;                .sort(&lt;span class="str"&gt;'-startDate'&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;                .exec(&lt;span class="kwrd"&gt;function&lt;/span&gt; (err, tasks) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            res.render(&lt;span class="str"&gt;'index'&lt;/span&gt;, {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;                page: &lt;span class="str"&gt;'index'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;                title: &lt;span class="str"&gt;'Task Manager - ToDo List'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;                tasks: tasks&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            });&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;     controllers.list = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) {   &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        Tasks.find({}, &lt;span class="kwrd"&gt;function&lt;/span&gt; (err, tasks) {        &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            res.render(&lt;span class="str"&gt;'list'&lt;/span&gt;, {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                page: &lt;span class="str"&gt;'list'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                title: &lt;span class="str"&gt;'Task Manager - Task List'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                tasks: tasks&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            });&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    controllers.newTask = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) { &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            res.render(&lt;span class="str"&gt;'add'&lt;/span&gt;, {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                page: &lt;span class="str"&gt;'add'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                title: &lt;span class="str"&gt;'Task Manager - Add Task'&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            });      &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    };  &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    controllers.addTask = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) { &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;         &lt;span class="kwrd"&gt;var&lt;/span&gt; form=req.body;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;         &lt;span class="kwrd"&gt;var&lt;/span&gt; task=&lt;span class="kwrd"&gt;new&lt;/span&gt; Tasks({&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;             name: form.name,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;             description: form.description,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;             status: form.status,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;             startDate: form.startdate,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;             dueDate: form.duedate,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;             completion: form.completion&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;         });  &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;          &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;          task.save(&lt;span class="kwrd"&gt;function&lt;/span&gt;(err) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(!err) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;                 res.redirect(&lt;span class="str"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;              } &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;        });             &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    controllers.editTask = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;        Tasks.findById(req.&lt;span class="kwrd"&gt;params&lt;/span&gt;.id, &lt;span class="kwrd"&gt;function&lt;/span&gt; (err, task) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;             res.render(&lt;span class="str"&gt;'edit'&lt;/span&gt;, {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;                page: &lt;span class="str"&gt;'add'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;                title: &lt;span class="str"&gt;'Task Manager - Edit Task'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;                task: task&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;            });&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;       });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;    controllers.updateTask = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; form = req.body;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;        Tasks.findById(form.id, &lt;span class="kwrd"&gt;function&lt;/span&gt; (err, task) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;            task.name = form.name;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;            task.description = form.description;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;            task.status = form.status;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;            task.startDate = form.startdate;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;            task.dueDate = form.duedate;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;            task.completion = form.completion;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            task.save(&lt;span class="kwrd"&gt;function&lt;/span&gt; (err) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!err) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;                 res.redirect(&lt;span class="str"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;            }  &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;             });             &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;    };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;    controllers.deleteTask = &lt;span class="kwrd"&gt;function&lt;/span&gt; (req, res) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;        Tasks.findById(req.&lt;span class="kwrd"&gt;params&lt;/span&gt;.id, &lt;span class="kwrd"&gt;function&lt;/span&gt; (err, task) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!err) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (task) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;                    task.remove();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;                    res.redirect(&lt;span class="str"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;            }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;    };        &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; controllers;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;};&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;module.exports = controllers;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;MongoDB Database in MongoLab&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;This web app is using MongoDB for persistence storage and the database will be deployed on &lt;a href="https://mongolab.com/welcome/" target="_blank"&gt;MongoLab&lt;/a&gt;. MongoLab is a cloud based database service for MongoDB&amp;#160; which provides the hosting options for multiple cloud vendors including Amazon, Joyent, Rackspace and Windows Azure. We will be using Windows Azure for our demo web app. MongoLab is providing a free sign-up option for 0.5 GB database.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below screen shot shows the create database option, which has chosen Windows Azure as the Cloud vendor &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/mongolab_536B9EEF.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mongolab" border="0" alt="mongolab" src="http://weblogs.asp.net/blogs/shijuvarghese/mongolab_thumb_3E99A66F.png" width="535" height="420" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4D80D589.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_19000341.png" width="609" height="459" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We will get a connection string for the MongoDB database from the MongoLab. I have put the connection string in the config.js file.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Create Windows Azure Web Site and download Publish Profile&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can easily create a Windows Azure Web Site from the &lt;a href="https://manage.windowsazure.com/" target="_blank"&gt;Windows Azure portal&lt;/a&gt;. For creating a new web site, choose New, WEB SITE, QUICK CREATE and give the URL and data center region as shown in the below picture.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_5CF3C18B.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_6189CC45.png" width="623" height="459" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Windows Azure Web Site provides a publish profile which lets the Azure developers to easily deploy Windows Azure apps from development IDEs such as Visual Studio, WebMatrix and Cloud9. To download the publish profile, go to the dashboard of the Web Site which we have created previously and click Download Publish Profile from the quick glance section. This will generate a publish profile file with extension PublishSettings. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_69BDF1DC.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_0EDB3C49.png" width="282" height="301" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Deploying the web app to Windows Azure&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can easily deploy web apps to Windows Azure from WebMatrix IDE by using the publish profile. Let’s import the publish profile to our web site created in WebMatrix. To import publish profile and deploy to Windows Azure, click Publish button of WebMatrix which will show a publish wizard:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_4568E78D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_785877F4.png" width="277" height="109" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_36055FB1.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_73B2476D.png" width="539" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Select the Import publish profile to import the publish profile, and choose the .publishsettings and save the profile. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_1C0179C2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_27B6C0F4.png" width="463" height="405" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;After saving the profile settings, continue the publish wizard which will deploy the web app to Windows Azure Web Site. Please note that publish profile is just a one time activity and you can deploy the app to windows azure at any time by simply clicking the publish button.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below screen shot shows that the web app is running at Windows Azure&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/shijuvarghese/image_1350FB69.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/shijuvarghese/image_thumb_3BA02DBD.png" width="580" height="389" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The source code for this demo app available at &lt;a title="https://github.com/shijuvar/NodeExpressMongo" href="https://github.com/shijuvar/NodeExpressMongo"&gt;https://github.com/shijuvar/NodeExpressMongo&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, we have developed a simple web app with Node.js and MongoDB. We have used Express.js framework for building the web app, and used cloud hosted MongoDB as service MongoLab for deploying MongoDB database. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;The Windows Azure Web Site allows the web app developers to easily build and deploy&amp;#160; web apps to Windows Azure. Microsoft WebMatrix is a great IDE that lets the developers to quickly deploy web apps to Windows Azure.&amp;#160; &lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=9697425" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/ShijuVBlog/~4/9yOFjeljVsg" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/NoSQL/default.aspx">NoSQL</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/JavaScript/default.aspx">JavaScript</category><feedburner:origLink>http://weblogs.asp.net/shijuvarghese/archive/2013/01/04/building-and-deploying-windows-azure-web-site-with-node-js-and-mongodb-by-using-microsoft-webmatrix.aspx</feedburner:origLink></item></channel></rss>
