<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Emmanuel&apos;s Blog</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/" />
   <link rel="self" type="application/atom+xml" href="http://blog.ehuna.org/atom.xml" />
   <id>tag:blog.ehuna.org,2010://9</id>
   <updated>2010-02-08T05:17:10Z</updated>
   <subtitle>Random general thoughts and ideas from Emmanuel Huna - some personal and some technical on software development and Microsoft technologies (WPF, WCF, ASP.NET, Windows Azure, SQL Azure, LINQ, ADO.NET, etc...)</subtitle>
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.35</generator>

<entry>
   <title><![CDATA[Red-Gate&rsquo;s SQL Compare &ndash; now with SQL Azure support!]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2010/01/redgates_sql_compare_now_with.html" />
   <id>tag:blog.ehuna.org,2010://9.351</id>
   
   <published>2010-01-30T06:11:00Z</published>
   <updated>2010-02-08T05:17:10Z</updated>
   
   <summary>For a few years I’ve been using SQL Compare from Red-Gate – an amazing product that allows you to do compare and synchronize SQL Server database schemas – and much more: For more info see - http://www.red-gate.com/products/SQL_Compare/index.htm&amp;#160; Red Gate has...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>For a few years I’ve been using <a href="http://www.red-gate.com/products/SQL_Compare/index.htm" target="_blank">SQL Compare</a> from Red-Gate – an amazing product that allows you to do compare and synchronize SQL Server database schemas – and much more:</p>  <blockquote>   <p><a href="http://www.red-gate.com/products/SQL_Compare/index.htm" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/RedGatesSQLComparenowwithSQLAzuresupport_CEA0/image.png" width="345" height="200" /></a>       <br /><em>For more info see -        <br /></em><a href="http://www.red-gate.com/products/SQL_Compare/index.htm"><em>http://www.red-gate.com/products/SQL_Compare/index.htm</em></a><em>&#160;</em></p> </blockquote>  <p>Red Gate has announced they now have an early access build of SQL Compare 8 that works with SQL Azure!&#160; If you're interested in trying this out please complete the form at:</p>  <p>&#160;&#160; <a href="http://www.red-gate.com/Azure"><font size="5">http://www.red-gate.com/Azure</font></a></p>  <p>Please note that I' do not work for Microsoft or Red Gate Software – I’m just a very happy customer.</p>  <p>Below I have more information on how this support for SQL Azure came about.&#160; Just like Microsoft has the “Windows 7 was my idea!” ads – I’m proud to say “Support for SQL Azure in SQL Compare was my idea!” – and this time it might just be true!</p> ]]>
      <![CDATA[  <p><strong>Red-Gate’s SQL Compare – now with SQL Azure support!</strong></p>  <p>A few months ago I posted a suggestion to Red-Gate: add support for SQL Azure in the SQL Compare product.&#160; You can read the <a href="http://www.red-gate.com/MessageBoard/viewtopic.php?p=37424" target="_blank">whole thread here</a> -</p>  <p><a href="http://blog.ehuna.org/liveimages/RedGatesSQLComparenowwithSQLAzuresupport_CEA0/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/RedGatesSQLComparenowwithSQLAzuresupport_CEA0/image6_thumb.png" width="612" height="448" /></a> </p>  <p>A couple of days ago, David Atkinson, a Product Manager at Red Gate Software had the following announcement:</p>  <p><a href="http://www.red-gate.com/MessageBoard/viewtopic.php?p=37424"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/RedGatesSQLComparenowwithSQLAzuresupport_CEA0/image_3.png" width="612" height="128" /></a> </p>  <p></p>  <p>I quickly asked David if I could download the early access build of SQL Compare that works with SQL Azure.&#160; I tried it out and it works great!</p>  <p>I had some feedback for David so we started emailing back and forth.&#160; At some point I had mentioned that I thought this support for SQL Azure would never come and I called my original suggestion in the forums a “feeble lobbying attempt”.&#160; David responded with the following:</p>  <blockquote>   <p><em>On Wed, Jan 27, 2010 at 4:44 PM, David Atkinson        <br />&lt;*********</em><a href="mailto:*********@red-gate.com"><em>@red-gate.com</em></a><em>&gt; wrote:</em></p> </blockquote>  <blockquote>   <p><em>[…] Hopefully this will convince you that your lobbying attempt was anything but feeble. </em></p>    <p><em>Here at Red Gate we note down every user request and make sure that it feeds directly into our product plans. </em></p>    <p><em>I can guarantee that without this post to our forum we would not have done the work to produce the Azure-compatible build, so please take credit for this!</em></p>    <p><em>Many regards,</em></p>    <p><em>David</em></p> </blockquote>  <p>This is awesome, thank you David!&#160; Not only Red Gate Software produces amazing software but they actually listen to their customers.</p>  <p>I can honestly say “Support for SQL Azure in SQL Compare was my idea!”.    <br />Good Times!</p>]]>
   </content>
</entry>
<entry>
   <title><![CDATA[How to speed up your Windows Azure Development &ndash; two screencasts available]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2010/01/how_to_speed_up_your_windows_a.html" />
   <id>tag:blog.ehuna.org,2010://9.350</id>
   
   <published>2010-01-29T05:33:00Z</published>
   <updated>2010-01-29T05:37:41Z</updated>
   
   <summary>Today I sat down with my co-worker Arif A. and we went over a couple of ways I found to speed up Windows Azure Development.&amp;#160; Basically we discuss how you can host your web roles in IIS and how you...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>Today I sat down with my co-worker Arif A. and we went over a couple of ways I found to speed up Windows Azure Development.&#160; </p>  <p><a href="http://screencasts.ehuna.org/2010/01/how_to_speed_up_windows_azure.html" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/HowtospeedupyourWindowsAzureDevelopmentt_12FED/image.png" width="436" height="335" /></a> </p>  <p>Basically we discuss how you can host your web roles in IIS and how you can create a keyboard shortcut to quickly attach the Visual Studio debugger to an IIS process – giving you your RAD (<a href="http://en.wikipedia.org/wiki/Rapid_application_development" target="_blank">Rapid Application Development</a>) process back!&#160; I created two separate screencasts which you can access below:</p>  <p>&#160; How to speed up Windows Azure Development (Part 1 of 2, 18 minutes)   <br />&#160; <a href="http://screencasts.ehuna.org/2010/01/how_to_speed_up_windows_azure.html">http://screencasts.ehuna.org/2010/01/how_to_speed_up_windows_azure.html</a></p>  <p>&#160; How to speed up Windows Azure Development (Part 2 of 2, 9 minutes)   <br />&#160; <a href="http://screencasts.ehuna.org/2010/01/how_to_speed_up_windows_azure_1.html">http://screencasts.ehuna.org/2010/01/how_to_speed_up_windows_azure_1.html</a></p>  <p>Each article contains the screencast, additional notes and a sample Visual Studio 2008 project you can download.&#160; Good Times!</p>]]>
      
   </content>
</entry>
<entry>
   <title><![CDATA[TechCrunch.com hacked&hellip; again]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2010/01/techcrunchcom_hacked_again.html" />
   <id>tag:blog.ehuna.org,2010://9.347</id>
   
   <published>2010-01-26T07:16:00Z</published>
   <updated>2010-01-26T07:19:05Z</updated>
   
   <summary>At 11:05 PM (PST) I checked out TechCrunch.com and saw: Now at 11:15 PM (PST) it just says: TechCrunch.com is hosted on Rackspace.com and some have reported this might be a security issue with Rackspace.com and that the attack could...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>At 11:05 PM (PST) I checked out <a href="http://www.techcrunch.com/" target="_blank">TechCrunch.com</a> and saw:</p>  <p><a href="http://blog.ehuna.org/liveimages/TechCrunch.comhackedagain_1479D/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/TechCrunch.comhackedagain_1479D/image_thumb.png" width="479" height="135" /></a> </p>  <p>Now at 11:15 PM (PST) it just says:</p>  <p><a href="http://blog.ehuna.org/liveimages/TechCrunch.comhackedagain_1479D/image_3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/TechCrunch.comhackedagain_1479D/image_thumb_3.png" width="477" height="99" /></a> </p>  <p>TechCrunch.com is hosted on Rackspace.com and <a href="http://www.inquisitr.com/59036/techcrunch-hacked/" target="_blank">some have reported</a> this might be a security issue with Rackspace.com and that the attack could be server based (and not DNS related).&#160; <a href="http://www.inquisitr.com/59036/techcrunch-hacked/" target="_blank">Inquisitr.com</a> reports that TechCrunch.com was hacked around 10 PM as well.&#160; These are interesting times we live in.&#160; </p>]]>
      
   </content>
</entry>
<entry>
   <title><![CDATA[How to stop getting exceptions when connecting to SQL Azure: &ldquo;System.Data.SqlClient.SqlException: An established connection was aborted by the software in your host machine&rdquo;]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2010/01/how_to_stop_getting_exceptions.html" />
   <id>tag:blog.ehuna.org,2010://9.346</id>
   
   <published>2010-01-25T04:33:00Z</published>
   <updated>2010-01-26T01:21:12Z</updated>
   
   <summary>Note: this is a technical article for developers who work with SQL Server, SQL Azure, Windows Azure, ADO.NET, .netTiers and other geek technologies.&amp;#160; Skip this if you’re not a developer – this will be really boring otherwise. We have deployed...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p><em>Note: this is a technical article for developers who work with SQL Server, SQL Azure, Windows Azure, ADO.NET, .netTiers and other geek technologies.&#160; Skip this if you’re not a developer – this will be really boring otherwise.</em></p>  <p>We have deployed a few web roles to Windows Azure and every once in a while we get the following exception when connecting to SQL Azure:</p>  <blockquote>   <p><em><strong>System.Data.SqlClient.SqlException</strong>: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.) </em></p> </blockquote>  <p>This does not happen on every call, but it happened over 70 times a few weeks ago as our QA team was testing our web role.&#160; Both the web roles and the SQL Azure database were in the same Windows Azure Data Center.&#160; We did set the maxconnection to 96 for connection pooling.&#160; We use .netTiers (<a href="http://nettiers.com/)">http://nettiers.com/)</a> for our ORM, it's similar to nHibernate. </p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb.png" width="367" height="357" /></a>       <br /><em>I asked <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/6002fbce-449c-4398-a2db-a16020dfeea0/" target="_blank">this question</a> on the Windows Azure Forums         <br />We finally figured out how to solve the issue when using .netTiers</em></p> </blockquote>  <p>Below I show you how you can avoid these exceptions – with a specific fix if you are using .netTiers (<a title="http://nettiers.com/" href="http://nettiers.com/">http://nettiers.com/</a>) as your ORM.&#160; See below for the exciting details.</p> ]]>
      <![CDATA[  <p><strong>The Problem</strong></p>  <p>As briefly described above, every once in a while we get an exception (a System.Data.SqlClient.SqlException) when one of our web or worker roles running on Windows Azure in the cloud attempts to connect to our SQL Azure database also running in the same Azure data center.&#160; The exception may look like this:</p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_3.png" width="621" height="238" /></a> </p> </blockquote>  <p><strong>The Solution – write retry logic</strong></p>  <p>It looks like the transport level errors are due to different timeouts between ADO.NET connection pools and SQL Azure.&#160; My guess is that the connections in the pool timeout at 10 minutes while SQL Azure times out at 5 minutes.</p>  <p>In threads found in the Windows Azure forums the current solution seems to be to write retry logic to work around this issue.&#160; This is different for every project, but here’s a sample solution from “DavidM51”:</p>  <blockquote>   <div class="csharpcode">     <pre class="alt"><em><span class="lnum">   1:  </span>Int16 retries = 0;</em></pre>

    <pre><em><span class="lnum">   2:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">   3:  </span>        TryAgain:</em></pre>

    <pre><em><span class="lnum">   4:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">   5:  </span>        <span class="kwrd">try</span></em></pre>

    <pre><em><span class="lnum">   6:  </span>        {</em></pre>

    <pre class="alt"><em><span class="lnum">   7:  </span>            <span class="kwrd">using</span> (SqlConnection conn = <span class="kwrd">new</span> SqlConnection(connectionString))</em></pre>

    <pre><em><span class="lnum">   8:  </span>            {</em></pre>

    <pre class="alt"><em><span class="lnum">   9:  </span>                conn.Open();</em></pre>

    <pre><em><span class="lnum">  10:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">  11:  </span>                SqlCommand cmd = <span class="kwrd">new</span> SqlCommand();</em></pre>

    <pre><em><span class="lnum">  12:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">  13:  </span>                cmd.Connection = conn;</em></pre>

    <pre><em><span class="lnum">  14:  </span>                cmd.CommandText = <span class="str">&quot;SPROC Name&quot;</span>;</em></pre>

    <pre class="alt"><em><span class="lnum">  15:  </span>                cmd.CommandType = CommandType.StoredProcedure;</em></pre>

    <pre><em><span class="lnum">  16:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">  17:  </span>        <span class="rem">//Code for SPROC</span></em></pre>

    <pre><em><span class="lnum">  18:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">  19:  </span>                Int32 rowsAffected = cmd.ExecuteNonQuery();</em></pre>

    <pre><em><span class="lnum">  20:  </span>&#160;</em></pre>

    <pre class="alt"><em><span class="lnum">  21:  </span>                <span class="rem">//Added conn.Close() to extraspecially make sure connection is closed!</span></em></pre>

    <pre><em><span class="lnum">  22:  </span>                conn.Close();</em></pre>

    <pre class="alt"><em><span class="lnum">  23:  </span>            }</em></pre>

    <pre><em><span class="lnum">  24:  </span>        }</em></pre>

    <pre class="alt"><em><span class="lnum">  25:  </span>        <span class="kwrd">catch</span> (Exception ex)</em></pre>

    <pre><em><span class="lnum">  26:  </span>        {</em></pre>

    <pre class="alt"><em><span class="lnum">  27:  </span>            CommonFunctions.LogActivity(<span class="str">&quot;SQL Error (Retry): &quot;</span> + ex.Message);</em></pre>

    <pre><em><span class="lnum">  28:  </span>            <span class="kwrd">if</span> (retries &lt; 1)</em></pre>

    <pre class="alt"><em><span class="lnum">  29:  </span>            {</em></pre>

    <pre><em><span class="lnum">  30:  </span>                retries++;</em></pre>

    <pre class="alt"><em><span class="lnum">  31:  </span>                <span class="rem">//Added short sleep</span></em></pre>

    <pre><em><span class="lnum">  32:  </span>                System.Threading.Thread.Sleep(50);</em></pre>

    <pre class="alt"><em><span class="lnum">  33:  </span>                <span class="kwrd">goto</span> TryAgain;</em></pre>

    <pre><em><span class="lnum">  34:  </span>            }</em></pre>

    <pre class="alt"><em><span class="lnum">  35:  </span>            <span class="rem">//Failed!</span></em></pre>

    <pre><em><span class="lnum">  36:  </span>            CommonFunctions.LogActivity(<span class="str">&quot;SQL Error (Failed): &quot;</span> + ex.Message);</em></pre>

    <pre class="alt"><em><span class="lnum">  37:  </span>        }</em></pre>
  </div>
</blockquote>
<style type="text/css">
.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; }</style>

<p>&#160;</p>

<p><strong>The Solution if using .netTiers – fix the “Retry” feature </strong></p>

<p>If you are using <a href="http://nettiers.com/" target="_blank">.netTiers</a>, we have this retry logic out of the box.&#160; In CodeSmith open your NetTiers.cst template and under Properties, check out the “07 – CRUD – Advanced” section:</p>

<blockquote>
  <p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_4.png" width="305" height="479" /></a> </p>
</blockquote>

<p>When my co-workers and I saw these properties, we said “great, we don’t need to write any retry logic of our own - <a href="http://nettiers.com/" target="_blank">.netTiers</a> once again has it out of the box!”.</p>

<p>Unfortunately, even though we set the values above and re-created and re-compiled our data access layer, we still kept seeing the exceptions when connecting to SQL Azure.</p>

<p>Last week, my co-worker Lanh found the problem (thanks Lanh!): there’s a bug in the .netTiers 2.3 templates – when the exception is raised at runtime, the .netTiers data access layer is not properly catching and executing the retry logic.</p>

<p>To fix this bug, open your NetTiers\DataAccessLayer\Utility.cst template:</p>

<blockquote>
  <p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_5.png" width="498" height="366" /></a> </p>
</blockquote>

<p>In line 459, change </p>

<p><em>&#160; catch (DataException)</em></p>

<p>to </p>

<p><em>&#160; catch (System.Data.SqlClient.SqlException)</em></p>

<blockquote>
  <p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_6.png" width="649" height="154" /></a> </p>
</blockquote>

<p>Save your Utility.cst, re-build your data access layer, re-compile and re-deploy to the Windows Azure Cloud and you should no longer see the “System.Data.SqlClient.SqlException” errors.</p>

<p>Good times!
  <br />Below I copy the full threads from the Microsoft forums.</p>

<hr />

<p><strong>Exceptions connecting to SQL Azure: &quot;An established connection was aborted by the software in your host machine</strong> 

  <br /><a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/6002fbce-449c-4398-a2db-a16020dfeea0/">http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/6002fbce-449c-4398-a2db-a16020dfeea0/</a></p>

<p></p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_7.png" width="677" height="658" /></a> </p>

<p>Here’s the text if anyone is doing a Google/Bing search -</p>

<blockquote>
  <p><em>On a web role that accesses a SQL Azure database, we keep getting the exception: 
      <br />&#160; System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.) 

      <br />This does not happen on every call, but it happened over 70 times last week as our QA team was testing our web role. 

      <br />Both the web role and the SQL Azure database are in the same data center. 

      <br />We did set the maxconnection to 96 for connection pooling. 

      <br />We use .netTiers (http://nettiers.com/) for our ORM, it's similar to nHibernate. 

      <br />Does anyone have any ideas on why this keeps happening? 

      <br />Here's the full exception - 

      <br />

      <br />MYMETHOD() Exception : System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at 

      <br />System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at 

      <br />System.Data.SqlClient.TdsParserStateObject.WriteSni() at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() at 

      <br />System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) at 

      <br />System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at 

      <br />System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at 

      <br />Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) at 

      <br />MYPROJECT.DataAccessLayer.Utility.ExecuteReader(Database database, DbCommand dbCommand) in C:\vss\MYPROJECT\MYPROJECTBusiness\main\MYPROJECT.DataAccessLayer\Utility.cs:line 361 at 

      <br />MYPROJECT.DataAccessLayer.SqlClient.SqlMycAccountUserProviderBase.GetPaged(TransactionManager transactionManager, String whereClause, String orderBy, Int32 start, Int32 pageLength, Int32&amp; count) in C:\vss\MYPROJECT\MYPROJECTBusiness\main\MYPROJECT.DataAccessLayer.SqlClient\SqlMycAccountUserProviderBase.generated.cs:line 638 at 

      <br />MYPROJECT.DataAccessLayer.Bases.EntityProviderBaseCore`2.GetTotalItems(TransactionManager mgr, String whereClause, Int32&amp; count) in C:\vss\MYPROJECT\MYPROJECTBusiness\main\MYPROJECT.DataAccessLayer\Bases\EntityProviderBaseCore.generated.cs:line 241 at 

      <br />MYPROJECT.DataAccessLayer.Bases.EntityProviderBaseCore`2.GetTotalItems(String whereClause, Int32&amp; count) in C:\vss\MYPROJECT\MYPROJECTBusiness\main\MYPROJECT.DataAccessLayer\Bases\EntityProviderBaseCore.generated.cs:line 228 at 

      <br />MYPROJECT.DeployManager.ClientResponseFacade.MYMETHOD(MYPROJECTPointClientRequest initialRequest) in C:\vss\MYPROJECT\MYPROJECT.Deploymanager\Main\ClientResponseFacade.cs:line 156 

      <br />

      <br />I searched the forums but found very few references to this error.</em></p>
</blockquote>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_8.png" width="684" height="551" /></a> </p>

<p></p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_9.png" width="686" height="328" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_10.png" width="685" height="631" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_11.png" width="690" height="216" /></a> </p>

<p>&#160;</p>

<p></p>

<hr />

<p></p>

<p><strong>Sporadic transport-level connection errors from SQL Azure 
    <br /><a title="http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/0545004d-8fc4-405a-8fb8-a4f22f167d44?prof=required" href="http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/0545004d-8fc4-405a-8fb8-a4f22f167d44?prof=required">http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/0545004d-8fc4-405a-8fb8-a4f22f167d44?prof=required</a></strong></p>

<p><strong></strong></p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_12.png" width="690" height="696" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_13.png" width="695" height="511" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_14.png" width="693" height="763" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_15.png" width="693" height="570" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_16.png" width="688" height="688" /></a> </p>

<p><a href="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_17.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Howtostopgettingexceptionswhenconnecting_E9B3/image_thumb_17.png" width="684" height="324" /></a></p>]]>
   </content>
</entry>
<entry>
   <title>A day in a restaurant</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/12/a_day_in_a_restaurant_1.html" />
   <id>tag:blog.ehuna.org,2009://9.345</id>
   
   <published>2009-12-14T00:45:24Z</published>
   <updated>2009-12-14T00:47:49Z</updated>
   
   <summary>Here’s another video from our Thanksgiving trip to Bend, Oregon.&amp;#160; Actually, this is a a stitched picture I made from a bunch of smaller pictures while watching the Raiders lose again earlier today.&amp;#160; There’s an iPhone app for that –...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>Here’s another video from our Thanksgiving trip to Bend, Oregon.&#160; Actually, this is a a stitched picture I made from a bunch of smaller pictures while watching the Raiders lose again earlier today.&#160; There’s an iPhone app for that – it’s called “Autostitch” ($1.99) – see the details at <a title="http://www.cloudburstresearch.com/" href="http://cloudburstresearch.com/">cloudburstresearch.com/</a>.</p>  <p>Here’s our family enjoying burgers and shakes in a relaxing environment at a restaurant called the Pilot Butte (<a href="http://www.pilotbutte.com">www.pilotbutte.com</a>), in Bend, OR:</p> <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8161499&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8161499&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>  <p>Turn up your sound and enjoy the relaxing Bossa Nova, Brazilian jazz from <a href="http://en.wikipedia.org/wiki/Ant%C3%B4nio_Carlos_Jobim" target="_blank">Antonio Carlos Jobim</a>.&#160; Below I copy the original stitched picture used in the video and a few other stitched pictures from the same trip.</p> ]]>
      <![CDATA[  <p>Stitched Pictures made directly    <br />on my iPhone using <a href="http://www.cloudburstresearch.com/autostitch/autostitch.html" target="_blank">AutoStitch</a></p>  <p>Click on any of the pictures to zoom in.    <br />Joe’s house – notice that Emma appears twice!</p>  <p><a href="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse2.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stitched-joe-house2" border="0" alt="stitched-joe-house2" src="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse2_thumb.jpg" width="463" height="128" /></a>     <br />    <br />Joe’s house, with a bit of the golf course: </p>  <p><a href="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse3.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stitched-joe-house3" border="0" alt="stitched-joe-house3" src="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse3_thumb.jpg" width="468" height="97" /></a>     <br />    <br />Joe’s house with Emma playing with Bingo:</p>  <p><a href="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse1.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stitched-joe-house1" border="0" alt="stitched-joe-house1" src="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjoehouse1_thumb.jpg" width="474" height="137" /></a>&#160; Jon driving on 97 near Bend, OR:</p>  <p><a href="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjondriving.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="stitched-jon-driving" border="0" alt="stitched-jon-driving" src="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/stitchedjondriving_thumb.jpg" width="474" height="165" /></a>     <br />    <br />A relaxing day at the restaurant – Nora is a ghost and uncle bogey makes a surprise appearance: </p>  <p><a href="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/pilotbuttepanoramicpicture.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="pilot-butte-panoramic-picture" border="0" alt="pilot-butte-panoramic-picture" src="http://blog.ehuna.org/liveimages/Adayinarestaurant_EECB/pilotbuttepanoramicpicture_thumb.jpg" width="472" height="107" /></a>     <br />A relaxing day at the Pilot Butte in Bend, OR     </p>]]>
   </content>
</entry>
<entry>
   <title><![CDATA[Bingo&rsquo;s first time in the snow]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/12/bingos_first_time_in_the_snow.html" />
   <id>tag:blog.ehuna.org,2009://9.343</id>
   
   <published>2009-12-13T21:38:00Z</published>
   <updated>2009-12-13T21:05:22Z</updated>
   
   <summary>Last month for Thanksgiving, Janelle and I went up to Bend, OR – where her Dad Joe lives.&amp;#160; We brought along, Bingo, our pup and he had the chance to play in the snow for the first time: Our niece...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>Last month for Thanksgiving, Janelle and I went up to Bend, OR – where her Dad Joe lives.&#160; We brought along, Bingo, our pup and he had the chance to play in the snow for the first time:</p> <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8157798&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8157798&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>  <p>Our niece Emma is shown in the second part of the video throwing the ball to Bingo.&#160; The background music is “Winter Wonderland” by <a href="http://en.wikipedia.org/wiki/Harry_Connick,_Jr." target="_blank">Harry Connick Jr.</a> and his daughter Kate.&#160; </p>]]>
      
   </content>
</entry>
<entry>
   <title>Visualizing Windows Azure diagnostic data</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/12/visualizing_windows_azure_diag_1.html" />
   <id>tag:blog.ehuna.org,2009://9.336</id>
   
   <published>2009-12-11T04:34:00Z</published>
   <updated>2009-12-11T03:59:39Z</updated>
   
   <summary>At the Microsoft Professional Developers conference as couple of weeks ago, I attended an excellent session on Windows Azure diagnostics.&amp;#160; Microsoft has made the video of this session available and you can check it out here: &amp;#160; Windows Azure Monitoring,...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>At the Microsoft Professional Developers conference as couple of weeks ago, I attended an excellent session on Windows Azure diagnostics.&#160; Microsoft has made the video of this session available and you can check it out here:</p>  <p>&#160; Windows Azure Monitoring, Logging, and Management APIs&#160; <br />&#160; <a title="http://microsoftpdc.com/Sessions/SVC15" href="http://microsoftpdc.com/Sessions/SVC15">http://microsoftpdc.com/Sessions/SVC15</a> (I also embed the video below)    <br />    <br />We followed some of the principles defined in the above session and turned on monitoring on our currently cloud deployed web and worker roles.&#160;&#160; Lanh, my co-worker, just finished the first version of our “Windows Azure Monitoring” application and we can now visualize this data – check out an example of our graphs:</p>  <blockquote>   <p>&#160;<a href="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsgraphs.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="windows-azure-diagnostics-graphs" border="0" alt="windows-azure-diagnostics-graphs" src="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsgraphs_thumb.jpg" width="397" height="296" /></a> <em>Visualizing Windows Azure web and worker roles performance counters        <br />Click on image to zoom in</em></p> </blockquote>  <p>We can see CPU and RAM usage by hour, by day and for the last week.&#160; Our system collects the data automatically from Azure storage or on demand.&#160; We keep one week of raw data, but the aggregate data (e.g. the graph data) we don’t delete.&#160; I think the graphs above are awesome – it’s like art!&#160; </p>  <p>I believe Microsoft will eventually have some cool tools for us in the Windows Azure portal , but having this custom Windows Azure diagnostics application will be useful regardless.&#160; For example, right now we will manually increase or decrease the number of web and worker role instances based on the performance counters above.&#160; But eventually we may use the Windows Azure Management APIs and allow this application to do it for us.&#160; </p>  <p>See below for more information on how we designed and implemented the above graphs.</p> ]]>
      <![CDATA[  <p><strong>Visualizing Windows Azure diagnostic data</strong></p>  <p>We created this application after attending the “Windows Azure Monitoring, Logging, and Management APIs” session at the Microsoft Professional Developers Conference 2009 – I embed the video below:</p> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="800" height="450"> <param name="source" value="http://microsoftpdc.com/Skins/PDC09/Styles/players/VideoPlayer2009_03_27.xap" /> <param name="initParams" value="m=http://ecn.channel9.msdn.com/o9/pdc09/wmvhigh/SVC15.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://microsoftpdc.com/Skins/PDC09/Styles/images/DefaultPlayerBackground.png, postid=0" /> <param name="background" value="#00FFFFFF" /> <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /> </a> </object>  <p><em>Watch the video above if you haven’t already done so – the information below will make a lot more sense.&#160; Also, Silverlight is required to watch the video – </em><a href="http://www.microsoft.com/silverlight/get-started/install/default.aspx" target="_blank"><em>install it here</em></a><em>.</em></p>  <p>To end up with the graphs above, we first defined 4 performance counters we wanted to keep track of:</p>  <ul>   <li>\ASP.NET Applications(__Total__)\Requests/Sec </li>    <li>\Processor(0)\% Processor Time </li>    <li>\Memory\Available Bytes </li>    <li>\WFPv4\Active Outbound Connections </li> </ul>  <p>For each of our 3 web roles and 1 worker role we logged each of the performance counters above into Azure storage every minute.&#160; By using Cerebrata’s excellent <a href="http://www.cerebrata.com/Products/CloudStorageStudio/Default.aspx" target="_blank">Cloud Storage Studio</a> we were then able to manually view each of the performance counters – here’s a screenshot of the raw data:</p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/image.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/image_thumb.png" width="410" height="138" /></a>&#160; <em>Windows Azure web and worker role performance counters –        <br />click on image to enlarge</em></p> </blockquote>  <p>Note that I blanked out some of our project names.&#160;&#160; Let’s look at the details of one of the events:</p>  <p><a href="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsrawdatadetail.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="windows-azure-diagnostics-rawdata-detail" border="0" alt="windows-azure-diagnostics-rawdata-detail" src="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsrawdatadetail_thumb.jpg" width="462" height="223" /></a> </p>  <p>In this case, we had a web role with two instances, so we are seeing that this event corresponds to the first instance (“_IN_0”) – we can see the number of available bytes in RAM for this web role instance.</p>  <p>With 4 role instances, at 4 performance counters per instance per minute, we are logging to Azure Storage:</p>  <ul>   <li>16 events per minute. </li>    <li>960 events per hour. </li>    <li>23,040 events per day. </li>    <li>161,280 events per week. </li>    <li>691,200 events in a 30-day month. </li> </ul>  <p></p>  <p>That’s a lot of data!&#160; That’s the reason we decided to keep one week of raw data, but the aggregate data (e.g. the graph data) we don’t delete.</p>  <p>Our application connects to Azure storage every few minutes and grabs the latest events.&#160; It stores them in an on-premise SQL Server and deletes them from Azure storage.</p>  <p>We then have an ASP.NET page which aggregates the data and creates these cool graphs:</p>  <p><a href="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsgraphs.jpg" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="windows-azure-diagnostics-graphs" border="0" alt="windows-azure-diagnostics-graphs" src="http://blog.ehuna.org/liveimages/VisualizingWindowsAzurediagnosticdata_BE67/windowsazurediagnosticsgraphs_thumb.jpg" width="397" height="296" /></a></p>  <p>Currently only our QA team is testing our web roles, so the CPU usage is fairly low.&#160; The peak on 12/3 of CPU usage to almost 100% is probably due to the deployment and initialization of the VM and role instances – that’s the day we upgraded our Azure services to the latest version of our CSPKG package.</p>  <p>Good times!</p>]]>
   </content>
</entry>
<entry>
   <title>An easier way to access the Windows Azure local development fabric from another computer</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/10/an_easier_way_to_access_the_wi.html" />
   <id>tag:blog.ehuna.org,2009://9.334</id>
   
   <published>2009-10-29T06:41:00Z</published>
   <updated>2009-10-29T20:47:58Z</updated>
   
   <summary>In development, when your Windows Azure web role is running in the local development fabric, you can normally only access it on http://127.0.0.1 on the local machine.&amp;#160; Using rinetd and ServiceEx to access local Azure web roles A couple of...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>In development, when your Windows Azure web role is running in the local development fabric, you can normally only access it on <a href="http://127.0.0.1">http://127.0.0.1</a> on the local machine.&#160; </p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image015.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image015" border="0" alt="clip_image015" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image015_thumb.png" width="429" height="195" /></a>      <br /><em>Using <a href="http://www.boutell.com/rinetd/" target="_blank">rinetd</a> and <a href="http://serviceex.com/" target="_blank">ServiceEx</a> to access local Azure web roles</em></p> </blockquote>  <p>A couple of days ago I published an article with instructions to bypass this localhost restriction:</p>  <p>&#160; Accessing the Windows Azure local development fabric from another computer    <br />&#160; <a title="http://blog.ehuna.org/2009/10/accessing_the_windows_azure_lo.html" href="http://blog.ehuna.org/2009/10/accessing_the_windows_azure_lo.html">http://blog.ehuna.org/2009/10/accessing_the_windows_azure_lo.html</a></p>  <p>The solution above uses SSH tunnels and involves two computers, a server and client and an authentication model.&#160; </p>  <p>I found a new way to bypass this localhost restriction, which is a bit simpler.&#160; See the details below.</p> ]]>
      <![CDATA[  <p><strong>An easier way to access the Windows Azure      <br />local development fabric from another computer</strong></p>  <p>Here's the setup overview -</p>  <p>1 – Download <a href="http://www.boutell.com/rinetd/">rinetd</a>, the internet ``redirection server''.     <br />2 – Configure rinetd.     <br />3 – Run rinetd (manually).     <br />4 – Download <a href="http://serviceex.com/">ServiceEx</a>, a windows application that allows a normal program to run as a Windows service.     <br />5 – Configure ServiceEx to make rinetd a windows service.     <br />6 – Run rinetd as a windows service</p>  <p>Thanks to my co-worker William for the ServiceEx tip!</p>  <p>You execute the above steps on the same computer where your Windows Azure local development fabric is running - let's call it MYSERVER1.</p>  <p>Note that I call this computer &quot;MYSERVER1&quot; but it does not have to be an actual Windows Server. In my case &quot;MYSERVER1&quot; is a Windows Vista Ultimate 32-bits running as a Virtual PC 2007 virtual machine.</p>  <p><strong>1 - Download rinetd</strong></p>  <p>rinetd is an old Unix utility – but there is a free Windows port here:</p>  <p>&#160; <a href="http://www.boutell.com/rinetd/">http://www.boutell.com/rinetd/</a>     <br />&#160; Download rinetd here: <a href="http://www.boutell.com/rinetd/http/rinetd.zip">http://www.boutell.com/rinetd/http/rinetd.zip</a></p>  <p>Once you download rinetd.zip, you will find a &quot;rinetd&quot; directory inside the ZIP file -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image001.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image001_thumb.png" width="416" height="456" /></a></p>  <p>The ZIP file contains the source code if you'd like to recompile it.    <br />For now, we'll simply extract the file rinetd.exe - and copy it to c:\winutil\rinetd     <br />(note: this could be any directory, in my example I will be using the directory c:\winutil\rinetd)</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image002.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image002_thumb.png" width="320" height="277" /></a></p>  <p>That's it - you've just installed rinetd.</p>  <p><strong>2 - Configured rinetd</strong></p>  <p>Now let's open a command line window and run rinetd -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image003.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image003_thumb.png" width="527" height="209" /></a></p>  <p>By default, rinetd looks for its configuration file in the default Unix location - &quot;/etc/rinetd.conf&quot;.</p>  <p>Since we are running It on Windows, we'll create our own configuration file in c:\winutil\rinetd\rinetd.conf</p>  <p>In our example, we have a Windows Azure project with one web role running an ASP.NET web site.&#160; We’ve defined the following InputEndpoint in our ServiceDefinition.csdef -</p>  <p>&lt;WebRole name=&quot;MYPROJECTONMYSERVER1_WebRole&quot; enableNativeCodeExecution=&quot;true&quot;&gt;    <br />&#160; &lt;InputEndpoints&gt;     <br />&#160;&#160;&#160; <strong>&lt;InputEndpoint name=&quot;HttpIn&quot; protocol=&quot;http&quot; port=&quot;8080&quot; /&gt;      <br /></strong>&#160; &lt;/InputEndpoints&gt;     <br />&#160; ...     <br />&lt;/WebRole&gt;</p>  <p>After we run my Azure project in Visual Studio (or use CSRun.exe), we see it was properly deployed in the local development fabric -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image004.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image004_thumb.png" width="532" height="145" /></a></p>  <p>We now open a browser and point it to <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a>     <br />(Visual Studio may have opened it for you if you checked &quot;Start web browser&quot;) -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image005.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image005" border="0" alt="clip_image005" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image005_thumb.png" width="341" height="78" /></a></p>  <p>We have verified that our web role is working fine.</p>  <p>The Windows Azure local development fabric only accepts requests on localhost, the IP address 127.0.0.1.&#160; To access it from another computer, we need to know MYSERVER1's IP address.    <br />    <br />In a cmd shell, type &quot;ipconfig&quot; -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image006.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image006_thumb.png" width="525" height="295" /></a></p>  <p>In my example, the IP address for MYSERVER1 is 10.0.10.133.    <br />Let’s create a new file named rinetd.conf in the c:\winutil\rinetd\ directory -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image007.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image007" border="0" alt="clip_image007" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image007_thumb.png" width="345" height="259" /></a></p>  <p>Entries in the rinetd.conf configuration file are forwarding rules. The format of a forwarding rule is as follows:</p>  <p>&#160; bindaddress bindport connectaddress connectport</p>  <p>We now open rinetd.conf with Notepad and add the following -</p>  <p>&#160; 10.0.10.133 8080 127.0.0.1 8080</p>  <p>This rule tells rinetd that if a request is made on port 8080 in the 10.0.10.133 IP address, it should be forwarded to port 8080 on the 127.0.0.1 IP address.</p>  <p>You can also add multiple rules in the rinetd.conf configuration file - here are three sample ports -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image008.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image008_thumb.png" width="481" height="211" /></a></p>  <p>That's it - we're done configuring rinetd.    <br />Save the rinetd.conf file and close Notepad.</p>  <p><strong>3 – Run rinetd (manually)</strong></p>  <p>Now, let's run rinetd, but this time we use the &quot;-c&quot; parameter passing in the rinetd.conf file location -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image009.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image009" border="0" alt="clip_image009" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image009_thumb.png" width="498" height="123" /></a></p>  <p>That's it! Now go to another computer and point your browser to <a href="http://10.0.10.133:8080">http://10.0.10.133:8080</a> -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image010.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image010_thumb.png" width="366" height="84" /></a></p>  <p>You've just accessed your Windows Azure web role from a machine that is not running the local development fabric - sweet!</p>  <p>We can also create a batch file, let's call it rinetd-run.bat to start rinetd with a click:</p>  <p><em>&#160; c:      <br />&#160; cd c:\WinUtil\rinetd       <br />&#160; start c:\WinUtil\rinetd\rinetd.exe -c c:\WinUtil\rinetd\rinetd.conf</em></p>  <p>We save this batch file in C:\WinUtil\rinetd\rinetd-run.bat so we can easily start rinetd anytime.</p>  <p><strong>4 – Download ServiceEx.</strong></p>  <p>As seen above it's pretty easy to configure and run rinetd.&#160; But there's one disadvantage in running it manually: every time we log off or reboot our computer, we need to run rinetd again.</p>  <p>In the next steps, we'll use ServiceEx, an application that allows us to run rinetd as a windows service.</p>  <p>Point your browser to:</p>  <p>&#160; <a href="http://serviceex.com/">http://serviceex.com/</a></p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image011.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image011" border="0" alt="clip_image011" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image011_thumb.png" width="487" height="137" /></a></p>  <p>- Download <a href="http://serviceex.com/files/ServiceEx.exe">http://serviceex.com/files/ServiceEx.exe</a> and save it in the c:\winutil\rinetd\ directory     <br />- Download <a href="http://serviceex.com/files/ServiceEx.ini.sample">http://serviceex.com/files/ServiceEx.ini.sample</a> and save it in the c:\winutil\rinetd\ directory     <br />- Rename c:\winutil\rinetd\ServiceEx.ini.sample to c:\winutil\rinetd\RinetdService.ini</p>  <p>You should now have the following files in the c:\WinUtil\rinetd\ directory -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image012.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image012_thumb.png" width="242" height="219" /></a></p>  <p><strong>5 – Configure ServiceEx to make rinetd a windows service.</strong></p>  <p>Here's the default ServiceEx.ini.sample file (which we renamed to RinetdService.ini):</p>  <blockquote>   <p><em>; Instructions for installing a service:        <br />;         <br />; 1. Edit this file. You need to fill in the values for ServiceExeFullPath, options,         <br />; desktop, Start and StartNow below.         <br />; 2. Decide on a name for the service.         <br />; 3. Save this file as that name, with an .ini extension added. For example, if you will name         <br />; the service &quot;NotepadService&quot;, you would save this file with the name NotepadService.ini         <br />; in the same directory where ServiceEx.exe is located.         <br />; 4. In Windows, select Start/Run then enter &quot;cmd&quot;, without the quotes, in the prompt.         <br />; 5. Chdir to the directory where you have placed ServiceEx.exe         <br />; 6. Type &quot;ServiceEx install &lt;servicename&gt;&quot;. If all goes well your service will be installed (and running,         <br />; if you so specified).         <br />;         <br />;         <br />; Once you have run ServiceEx successfully, if you want to change the values in this file, you should do the following:         <br />;         <br />; 1. Stop the service (i.e. run &quot;net stop &lt;serviceName&gt; at the command line)         <br />; 2. Remove the service (i.e. run &quot;ServiceEx remove &lt;serviceName&gt;)         <br />; 3. Edit and save this file as desired. This file must be named the same as the service name with an .ini extension added.         <br />; 4. Install the newly configured service (i.e. run &quot;ServiceEx install &lt;serviceName&gt;).         <br />;         <br />; Unless you change the executable file, it is better to use the service manager to modify these values.         <br />; Please visit serviceex.com for information on how to do that.         <br />;         <br />; full path to exe to be run as a service--use quotes if path contains spaces         <br />; The section identifier below is REQUIRED         <br />[ServiceEx]         <br />ServiceExeFullPath = &quot;C:\Program Files\My Program.exe&quot;         <br />; program arguments to be sent to executable         <br />options =         <br />; can program interact with desktop [true | false] (default: true)         <br />desktop = true         <br />; start type (valid values: Auto Manual Disabled) (default: auto)         <br />Start=Auto         <br />; start the service upon installation [true | false] (default: no)         <br />StartNow=false</em></p> </blockquote>  <p>Let’s open RinetdService.ini in Notepad (or your favorite text editor), and make the following changes:</p>  <p><em>&#160; ServiceExeFullPath = &quot;c:\WinUtil\rinetd\rinetd.exe&quot;      <br />&#160; options = -c c:\WinUtil\rinetd\rinetd.conf</em></p>  <p>So we end up with this:</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image013.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image013" border="0" alt="clip_image013" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image013_thumb.png" width="554" height="383" /></a></p>  <p>Let’s save our changes and close Notepad. We now open a cmd window and go to the c:\WinUtil\rinetd\ directory, then run:</p>  <p>&#160; <em>ServiceEx install RinetdService      <br />&#160; </em>(Note that you do not add &quot;.ini&quot; to &quot;RinetdService)</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image014.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image014_thumb.png" width="543" height="186" /></a></p>  <p>If you go to control panel &gt; services, you should now see &quot;RinetdService&quot; installed -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image015.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image015" border="0" alt="clip_image015" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image015_thumb.png" width="547" height="248" /></a></p>  <p><strong>6 – Run rinetd as a Windows Service</strong></p>  <p>You can start and stop it using the Services panel, or you can do it from the command line using -</p>  <p>&#160; To start: <em>&quot;net start RinetdService&quot;      <br /></em>&#160; To stop: <em>&quot;net stop RinetdService&quot;</em></p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image016.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image016_thumb.png" width="539" height="156" /></a></p>  <p>In Task Manager you can verify that rinetd.exe is indeed running:</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image017.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image017" border="0" alt="clip_image017" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image017_thumb.png" width="534" height="254" /></a></p>  <p>Now log off or reboot - once you run your Azure web role again, try accessing it from another computer -</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image0101.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010[1]" border="0" alt="clip_image010[1]" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image0101_thumb.png" width="336" height="77" /></a></p>  <p>It just works - like magic! ;-)</p>  <p>If we run CurrPorts (<a href="http://www.nirsoft.net/utils/cports.html">http://www.nirsoft.net/utils/cports.html</a>), we see that rinetd is listening on ports 8080, 8081 and 8082:</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image0011.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001[1]" border="0" alt="clip_image001[1]" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image0011_thumb.png" width="535" height="141" /></a></p>  <p>One last note: if you want to make changes to rinetd.conf, you must follow these instructions -</p>  <blockquote>   <p><em>; Once you have run ServiceEx successfully, if you want to change the values in this file, you should do the following:        <br />;         <br />; 1. Stop the service (i.e. run &quot;net stop &lt;serviceName&gt; at the command line)         <br />; 2. Remove the service (i.e. run &quot;ServiceEx remove &lt;serviceName&gt;)         <br />; 3. Edit and save this file as desired. This file must be named the same as the service name with an .ini extension added.         <br />; 4. Install the newly configured service (i.e. run &quot;ServiceEx install &lt;serviceName&gt;).</em> </p> </blockquote>  <p>Here's a sample screenshot of running ServiceEx to remove the RinetdService windows service:</p>  <p><a href="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image018.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://blog.ehuna.org/liveimages/AneasierwaytoaccesstheWindowsAzurelocald_C1FD/clip_image018_thumb.png" width="511" height="390" /></a></p>  <p>Good times!</p>]]>
   </content>
</entry>
<entry>
   <title>Accessing the Windows Azure local development fabric from another computer</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/10/accessing_the_windows_azure_lo.html" />
   <id>tag:blog.ehuna.org,2009://9.333</id>
   
   <published>2009-10-27T18:28:00Z</published>
   <updated>2009-10-27T22:42:44Z</updated>
   
   <summary>A couple of months ago when I started working with Windows Azure, I quickly realized that a web role running on the local development fabric could only bind to localhost (127.0.0.1).&amp;#160; I opened a thread in the Microsoft forums: &amp;#160;...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>A couple of months ago when I started working with Windows Azure, I quickly realized that a web role running on the local development fabric could only bind to localhost (127.0.0.1).&#160; I opened a thread in the Microsoft forums:</p>  <p>&#160; Can the development fabric bind to the real IP address? (not 127.0.0.1)    <br />&#160; <a title="http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/9b8957e6-7983-47a7-9d75-954dee70dbf0" href="http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/9b8957e6-7983-47a7-9d75-954dee70dbf0">http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/9b8957e6-7983-47a7-9d75-954dee70dbf0</a></p>  <p>One developer, JuanSueroNYC, found a way to make this work for WCF services.&#160; But I want to access ASP.NET Sites as well as WCF Services running on my Azure web roles – and I’d like to make it as simple as possible (one time configuration).</p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/image_thumb.png" width="397" height="212" /></a>&#160; <br /><em>We create SSH tunnels using freeSSHd and PuTTY</em></p> </blockquote>  <p>Whenever I’m working on a project I like to use CruiseControl.NET (<a title="http://ccnet.thoughtworks.com/" href="http://ccnet.thoughtworks.com/">http://ccnet.thoughtworks.com/</a>) and create a continuous integration system.&#160; Every night at 2:00 AM , this system is responsible for getting the latest code from source control, compiling, running unit tests, deploying and more.&#160; This allows our business folks to get an earlier look at our product and makes sure no single developer or designer has broken the build.</p>  <p>We also work on WPF smart clients and I didn’t want to force the client teams to run the Azure web roles on their machines just because Microsoft only allows the local development fabric to bind to 127.0.0.1.</p>  <p>I was bummed out when I realized that Microsoft has placed this dumb restriction on Windows Azure web roles.&#160; I’ve seen a response from Microsoft where they mumble something about the local development fabric running with admin rights and that not being secure – but I could always run IIS with admin rights – should we only allow IIS to bind to 127.0.0.1?&#160; </p>  <p>My guess is that this dumb decision was made by some pointy head guy who doesn’t understand technology and was afraid that from a business perspective developers would use the local development fabric as a cheap Production load balancer.&#160; Ridiculous – but don’t underestimate the stupidity of business folks.</p>  <p>Ok, enough ranting – see below for a full tutorial on how to access web roles running on a Windows Azure local development fabric from any other computer and not only on <a href="http://127.0.0.1">http://127.0.0.1</a> on the local host.&#160; Thanks to my co-worker Lanh for coming up with this solution – great work!</p> ]]>
      <![CDATA[  <p><strong>Accessing the Windows Azure local development fabric from another computer</strong></p>  <p>In development, when your Windows Azure web role is running in the local development fabric, you can normally only access it on <a href="http://127.0.0.1">http://127.0.0.1</a> on the local machine.</p>  <p>The document below describes how to access this web role from any other computer using SSH tunnels.</p>  <p><strong>Setup Overview</strong></p>  <p>1 – Install freeSSHd, the SSH server, from <a href="http://www.freesshd.com">http://www.freesshd.com</a>     <br />2 – Add users to freeSSHd.     <br />3 – Allow tunneling in freeSSHd.     <br />4 – Start the freeSSHd service.     <br />5 – Download and install <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">PuTTY</a>, the SSH client.     <br />6 – Configure PuTTY     <br />7 - Run PuTTY </p>  <p>Let's define two computers:</p>  <blockquote>   <p><em><strong>MYSERVER1 </strong>- the computer where you're doing your Azure development, where you're running Visual Studio or CSRun.exe. Basically the computer where the local development fabric is running. This is where we'll run freeSSHd, the SSH server.</em></p>    <p><em><strong>MYSERVER2 </strong>- the computer that will run PuTTY, the SSH client.</em></p> </blockquote>  <p>Note that I call these computers &quot;MYSERVER1&quot; and &quot;MYSERVER2&quot; but these do not have to be actual Windows Servers.</p>  <p>In my case &quot;MYSERVER1&quot; was Windows Vista Ultimate 32-bits running as a Virtual PC 2007 virtual machine, while &quot;MYSERVER2&quot; was a Windows Server 2008 R2 server (not a VM).</p>  <p><strong>On MYSERVER1</strong></p>  <p><strong>1. Download and install freeSSHd</strong></p>  <p>Download freeSSHd from from <a href="http://www.freesshd.com">http://www.freesshd.com</a></p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image001.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image001_thumb.png" width="457" height="155" /></a></p>  <p>Install freeSSHd -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image002.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image002_thumb.png" width="453" height="348" /></a></p>  <p>Accept the default options and click &quot;Next&quot; a bunch of times.</p>  <p>When you're asked if private keys should be created, click &quot;Yes&quot;.</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image003.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image003_thumb.png" width="453" height="350" /></a></p>  <p>Also click &quot;Yes&quot; when asked if you want to run freeSSHd as a system service:</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image004.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image004_thumb.png" width="448" height="348" /></a></p>  <p>Click Finish.</p>  <p><strong>2. Add user to freeSSHd</strong></p>  <p>Click on the Windows Start menu and start freeSSHd -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image005.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image005" border="0" alt="clip_image005" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image005_thumb.png" width="445" height="188" /></a></p>  <p>In Vista/Windows Server 2008, note that I run it as an Administrator - otherwise I found the settings I was defining were not being picked up by the freeSSHDService windows service later.</p>  <p>The freeSSHd icon should appear in the tray area, right click and choose &quot;Settings…&quot;</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image006.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image006_thumb.png" width="284" height="124" /></a></p>  <p>The freeSSHd settings window appears, click on the Users tab -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image007.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image007" border="0" alt="clip_image007" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image007_thumb.png" width="443" height="423" /></a></p>  <p>Then click on &quot;Add…&quot; -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image008.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image008_thumb.png" width="417" height="448" /></a></p>  <p>We create a user called &quot;webroleclient&quot; with the options above.</p>  <p>Make sure you remember the password, we'll need it later.</p>  <p>Click 'OK' and the &quot;webroleclient&quot; login is created -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image009.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image009" border="0" alt="clip_image009" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image009_thumb.png" width="422" height="401" /></a></p>  <p><strong>3. Allow Tunneling in freeSSHd</strong></p>  <p>Now click on the &quot;Tunneling tab -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image010.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image010_thumb.png" width="420" height="397" /></a></p>  <p>Allow both local and remote port forwarding and click 'OK'.</p>  <p><strong>4. Start the freeSSHd service</strong></p>  <p>You can start the SSH server through the settings UI, but it's better to start the windows service.</p>  <p>This way if you reboot, the server will run.</p>  <p>If you've started the SSH server through the settings UI, you'll see a green status under the &quot;Server status&quot; tab:</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image011.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image011" border="0" alt="clip_image011" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image011_thumb.png" width="406" height="386" /></a></p>  <p>Click on &quot;Click here to stop it&quot; and make sure the SSH server is not running -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image012.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image012_thumb.png" width="410" height="388" /></a></p>  <p>Now right-click on Computer &gt; Manage &gt; Services and Applications &gt; Services</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image013.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image013" border="0" alt="clip_image013" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image013_thumb.png" width="497" height="276" /></a></p>  <p>Double click on the &quot;FreeSSHDService&quot; entry -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image014.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image014_thumb.png" width="407" height="458" /></a></p>  <p>Set the &quot;Startup type&quot; to &quot;Automatic&quot; and click &quot;Apply&quot;.</p>  <p>Then click &quot;Start&quot; -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image015.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image015" border="0" alt="clip_image015" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image015_thumb.png" width="402" height="455" /></a></p>  <p>Click 'OK' and you should see the FreeSSHDService started and its startup type set to &quot;Automatic&quot; -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image016.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image016_thumb.png" width="399" height="180" /></a></p>  <p><strong>5. Download and install PuTTY</strong></p>  <p><strong>The steps below should now be executed on MYSERVER2</strong></p>  <p>The steps below are now executed on MYSERVER2. This will typically be the machine from where you are trying to access the Azure web role running on the local development fabric on MYSERVER1, but it could be any other machine. We couldn't get both the SSH client and server working on the same machine, so we had to use another computer.</p>  <p>Point your browser to <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</a> and download PuTTY for your OS -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image017.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image017" border="0" alt="clip_image017" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image017_thumb.png" width="393" height="216" /></a></p>  <p>You can download the installer or just the putty.exe itself.    <br />If you use <a href="http://portableapps.com/">PortableApps.com</a>, there's also a portable Putty:</p>  <p><a href="http://portableapps.com/apps/internet/putty_portable">http://portableapps.com/apps/internet/putty_portable</a></p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image018.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image018_thumb.png" width="395" height="133" /></a></p>  <p>See my screencast on <a href="http://screencasts.ehuna.org/2008/09/cloud_computing_today_not_tomo.html">Cloud computing today, not tomorrow</a> - using Live Mesh (<a href="https://www.mesh.com/">https://www.mesh.com/</a>) with <a href="http://portableapps.com/">PortableApps.com</a> rocks.</p>  <p><strong>6. Configure PuTTY</strong></p>  <p>Run PuTTY which shows the &quot;Session&quot; screen - </p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image019.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image019" border="0" alt="clip_image019" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image019_thumb.png" width="395" height="380" /></a></p>  <p>Set 'Host Name' to 'MYSERVER1' (or use its IP address)    <br />Set 'Saved Sessions&quot; to 'MYSERVER1'     <br />Click 'Save' -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image020.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image020" border="0" alt="clip_image020" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image020_thumb.png" width="395" height="380" /></a></p>  <p>Click on Connection &gt; SSH &gt; Tunnels</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image021.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image021" border="0" alt="clip_image021" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image021_thumb.png" width="395" height="380" /></a></p>  <p>Check 'Local ports accept connections from other hosts'</p>  <p>Set the source port to '8080' (or whatever you have defined as one of your Windows Azure web role InputEndpoints -</p>  <p>&lt;WebRole name=&quot;MYPROJECTONMYSERVER1_WebRole&quot; enableNativeCodeExecution=&quot;true&quot;&gt;    <br />&#160; &lt;InputEndpoints&gt;     <br />&#160; &lt;InputEndpoint name=&quot;HttpIn&quot; protocol=&quot;http&quot; port=&quot;8080&quot; /&gt;     <br />&#160; &lt;/InputEndpoints&gt;     <br />&#160; ...     <br />&lt;/WebRole&gt;</p>  <p>Set the destination to '127.0.0.1:8080'</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image022.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image022" border="0" alt="clip_image022" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image022_thumb.png" width="384" height="370" /></a></p>  <p>Click 'Add'</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image023.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image023" border="0" alt="clip_image023" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image023_thumb.png" width="386" height="372" /></a></p>  <p>Go back to the Session category and click 'Save' - </p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image024.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image024" border="0" alt="clip_image024" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image024_thumb.png" width="386" height="375" /></a></p>  <p><strong>7. Run PuTTY</strong></p>  <p>Run PuTTY and click on Session</p>  <p>Click on 'MYSERVER1' &gt; Load</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image025.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image025" border="0" alt="clip_image025" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image025_thumb.png" width="383" height="369" /></a></p>  <p>Click 'Open' -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image026.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image026" border="0" alt="clip_image026" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image026_thumb.png" width="388" height="113" /></a></p>  <p>Login as 'webroleclient' and use the password we defined in step 2, Add user to freeSSHd.</p>  <p>You should now be logged in and you can use the cmd shell on MYSERVER1.</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image027.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image027" border="0" alt="clip_image027" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image027_thumb.png" width="497" height="98" /></a></p>  <p>That's it - you're done you can now access your Windows Azure web role running in the local development fabric from any computer by simply pointing using the SSH tunnel you've created on MYSERVER2!</p>  <p><strong>7. Examples: Web Roles running an ASP.NET site and a WCF Service</strong></p>  <p><em>ASP.NET Web Site      <br /></em>For example. let's say on MYSERVER1 you have a Windows Azure project with one web role running an ASP.NET web site.</p>  <p>You've defined the following InputEndpoint in your ServiceDefinition.csdef -</p>  <p>&lt;WebRole name=&quot;MYPROJECTONMYSERVER1_WebRole&quot; enableNativeCodeExecution=&quot;true&quot;&gt;    <br />&#160; &lt;InputEndpoints&gt;     <br />&#160;&#160;&#160; &lt;InputEndpoint name=&quot;HttpIn&quot; protocol=&quot;http&quot; port=&quot;8080&quot; /&gt;     <br />&#160; &lt;/InputEndpoints&gt;     <br />&#160; ...     <br />&lt;/WebRole&gt;</p>  <p>You run your project in Visual Studio (or use CSRun.exe) and you see it was properly deployed in the local development fabric -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0014.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001[4]" border="0" alt="clip_image001[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0014_thumb.png" width="488" height="133" /></a></p>  <p>On MYSERVER1, you open a browser and point it to <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a></p>  <p>(Visual Studio may have opened it for you if you checked &quot;Start web browser&quot;)</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0024.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0024_thumb.png" width="403" height="92" /></a></p>  <p>You verify that your web role is working fine.</p>  <p>Now on MYSERVER2, you open a browser and point it to <a href="http://MYSERVER2:8080/">http://MYSERVER2:8080/</a></p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0034.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image003[4]" border="0" alt="clip_image003[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0034_thumb.png" width="401" height="100" /></a></p>  <p>You can now access your web role running on MYSERVER1 from MYSERVER2 or any other computer that can connect to MYSERVER2!</p>  <p><em>WCF Service      <br /></em>Now let's say you have a WCF Service hosted on a Windows Azure's web role.&#160; You've defined the following InputEndpoint in your ServiceDefinition.csdef -</p>  <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;    <br />&lt;ServiceDefinition name=&quot;ServiceAzureHost&quot; xmlns=&quot;<a href="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition</a>&quot;&gt;     <br />&#160; &lt;WebRole name=&quot;ServiceAzure_WebRole&quot; enableNativeCodeExecution=&quot;true&quot;&gt;     <br />&#160;&#160;&#160; &lt;InputEndpoints&gt;     <br />&#160;&#160;&#160;&#160;&#160; &lt;InputEndpoint name=&quot;HttpIn&quot; protocol=&quot;http&quot; port=&quot;8000&quot; /&gt;     <br />&#160;&#160;&#160; &lt;/InputEndpoints&gt;     <br />&#160;&#160;&#160; &lt;ConfigurationSettings /&gt;     <br />&#160; &lt;/WebRole&gt;     <br />&lt;/ServiceDefinition&gt;</p>  <p>You run your project in Visual Studio (or use CSRun.exe) and you see it was properly deployed in the local development fabric -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0044.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004[4]" border="0" alt="clip_image004[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0044_thumb.png" width="538" height="177" /></a></p>  <p>On MYSERVER1, you open a browser and point it to your service - in my example: <a href="http://127.0.0.1:8000/PointCentralService.svc">http://127.0.0.1:8000/PointCentralService.svc</a></p>  <p>(Visual Studio may have opened it for you if you checked &quot;Start web browser&quot;)</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0054.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image005[4]" border="0" alt="clip_image005[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0054_thumb.png" width="473" height="365" /></a></p>  <p>On MYSERVER2, we add one more tunnel to PuTTY's configuration for the MYSERVER1 session:</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0064.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006[4]" border="0" alt="clip_image006[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0064_thumb.png" width="431" height="417" /></a></p>  <p>We click 'Add' and see the new tunnel needed for our WCF Service:</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0074.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image007[4]" border="0" alt="clip_image007[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0074_thumb.png" width="427" height="413" /></a></p>  <p>Remember to go back to the 'Session' screen and save/update your MYSERVER1 session.</p>  <p>Now open the MYSERVER1 session in PuTTY and login -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0084.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008[4]" border="0" alt="clip_image008[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0084_thumb.png" width="421" height="103" /></a></p>  <p>Once logged in you'll see the cmd shell prompt -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0094.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image009[4]" border="0" alt="clip_image009[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0094_thumb.png" width="492" height="120" /></a></p>  <blockquote>   <p><em><strong>Tip</strong>: PuTTY works from the command line - add it to a batch file -        <br />&#160; PuTTY.exe -load &quot;&lt;SESSIONNAME&gt;&quot; -l &lt;USERNAME&gt; -pw &lt;PASSWORD&gt;        <br />        <br />&#160; Example in batch file:         <br />&#160;&#160;&#160; start PuTTY -load &quot;MYSERVER1&quot; -l webroleclient -pw mypw162</em></p> </blockquote>  <p>Now open a browser on MYSERVER2 or any other computer and point it to <a href="http://MYSERVER2:8000/PointCentralService.svc">http://MYSERVER2:8000/PointCentralService.svc</a> -</p>  <p><a href="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0104.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010[4]" border="0" alt="clip_image010[4]" src="http://blog.ehuna.org/liveimages/AccessingtheWindowsAzurelocaldevelopment_9A32/clip_image0104_thumb.png" width="492" height="372" /></a></p>  <p>We can see our WCF Service definition, access its WSDL, or run clients from any other computer - accessing the web role running on MYSERVER1.</p>  <p>Good times!</p>]]>
   </content>
</entry>
<entry>
   <title><![CDATA[Slide-show: from &lsquo;Storage room&rsquo; to &lsquo;Endless Pool room&rsquo;]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/10/slideshow_from_storage_room_to.html" />
   <id>tag:blog.ehuna.org,2009://9.332</id>
   
   <published>2009-10-27T16:10:00Z</published>
   <updated>2009-11-06T17:00:27Z</updated>
   
   <summary>During the weekend I created a slide-show that shows how we transformed an old storage room into a room that now hosts our Endless Pool (click here to check out ‘First swim in our Endless Pool’). &amp;#160; The slide-show: http://slideshow.ehuna.org/home/200908-endlesspool/...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>During the weekend I created a slide-show that shows how we transformed an old storage room into a room that now hosts our Endless Pool (<a href="http://blog.ehuna.org/2009/10/endless_pool_purchased_on_ebay.html" target="_blank">click here</a> to check out ‘First swim in our Endless Pool’).</p>  <blockquote>   <p><a href="http://slideshow.ehuna.org/home/200908-endlesspool/" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/SlideshowfromStorageroomtoEndlessPoolroo_813C/image.png" width="456" height="343" /></a>&#160; <br />The slide-show: <a title="http://slideshow.ehuna.org/home/200908-endlesspool/" href="http://slideshow.ehuna.org/home/200908-endlesspool/" target="_blank">http://slideshow.ehuna.org/home/200908-endlesspool/</a></p> </blockquote>  <p>The slideshow gives you an idea of how houses are built in northern California.&#160; With the insulation and the double pane windows this is the best room in the house!</p>  <p>The song is “<a href="http://en.wikipedia.org/wiki/New_Soul" target="_blank">New Soul</a>” by the French/Israeli singer <a href="http://en.wikipedia.org/wiki/Yael_Naim" target="_blank">Yael Naim</a>.&#160; This song was featured in one of Apple’s recent ads for the MacBook Air.&#160; The slideshow runs for about 10 minutes and the song is about 3 minutes long – so it will repeat.</p>]]>
      
   </content>
</entry>
<entry>
   <title>First swim in our Endless Pool</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/10/endless_pool_purchased_on_ebay.html" />
   <id>tag:blog.ehuna.org,2009://9.300</id>
   
   <published>2009-10-18T01:59:00Z</published>
   <updated>2009-10-22T04:00:38Z</updated>
   
   <summary>For the past few months our contractor has been busy installing our new Endless pool and fixing up an old storage room that now hosts the pool.&amp;#160; Yesterday the cover was installed and the work is almost done!&amp;#160; In the...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="01 - General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>For the past few months our contractor has been busy installing our new Endless pool and fixing up an old storage room that now hosts the pool.&#160; </p>  <p>Yesterday the cover was installed and the work is almost done!&#160; In the video below I give an overview of the Endless Pool and take it out for a first swim:</p> <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7121436&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7121436&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>  <p>Thanks to Yury Guzman and the whole crew from Grand Land Masters – they did an amazing job with the room and the Endless Pool installation.&#160; If you are in the San Francisco Bay Area and you want one of these installed give Yury a call - <a title="http://glmlandscapes.com/" href="http://glmlandscapes.com/">http://glmlandscapes.com/</a> – you won’t regret it.    <br />    <br /><strong>Update 10/21</strong>: for Jon and other iPhone users, I also uploaded the video to YouTube – you can <a href="http://www.youtube.com/watch?v=ZHSykGEUWeY" target="_blank">view it here</a>.</p>  <p>The background music is a Brazilian Bossa Nova song named “<a href="http://en.wikipedia.org/wiki/Agua_de_Beber" target="_blank">Agua de Beber</a>” sung by Astrid Gilberto and written by <a href="http://en.wikipedia.org/wiki/Antonio_Carlos_Jobim" target="_blank">Antonio Carlos Jobim</a>.&#160; Below I have more information on the Endless Pool and how it works.</p> ]]>
      <![CDATA[  <p><strong>Endless Pool Overview</strong></p>  <p>A few months ago, I purchased an <a href="http://www.endlesspools.com/gallery/slideshow.html" target="_blank">Endless Pool</a> on eBay.&#160; The Endless Pool is typically smaller than a regular pool (our is 14x8), but it has a hydraulic motor and a propeller to create a current – it has been called a “Swimming Pool Treadmill” -</p>  <blockquote>   <p><a href="http://www.endlesspools.com/gallery/slideshow.html" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/EndlessPoolpurchasedoneBay_CA09/image.png" width="367" height="260" /></a>       <br /><em>The Endless Pool – smaller than a regular pool, but with a current</em></p> </blockquote>  <p>PG&amp;E’s (Northern California’s utility company) setbacks and zoning restrictions are a pain in the <a href="http://www.urbandictionary.com/define.php?term=tuchas" target="_blank">tuchas</a> so we decided to install the Endless Pool inside one of our rooms – an old room we used for storage.&#160; We did a bunch of work on the room and the Endless Pool is now completely done!&#160; </p>  <p>The weather is so nice in California (it’s over 80 degrees Fahrenheit today, in the middle of October) that we’ll enjoy the swimming pool year round.</p>  <p>Here are some of the <a href="http://www.endlesspools.com/whatis/what_special.html" target="_blank">advantages of an Endless Pool</a> over a regular pool:</p>  <ul>   <li><strong>It offers all the benefits</strong> of a large swimming pool in a small space. </li>    <li><strong>The swimming pool and its water quality system require </strong>very little maintenance. </li>    <li><strong>The unique, swim current</strong> is completely adjustable in speed, from zero to racer's pace. </li> </ul>  <blockquote>   <p><a href="http://www.endlesspools.com/whatis/what_work.html" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/EndlessPoolpurchasedoneBay_CA09/image_3.png" width="205" height="244" /></a>       <br /><em>The Endless Pool internal        <br />current, <a href="http://www.endlesspools.com/whatis/what_work.html" target="_blank">click here</a> for video</em></p> </blockquote>  <ul>   <li><strong>The Endless Pools kit comes complete</strong> with everything needed for swimming or exercise. </li>    <li><strong>Excellent for many purposes: </strong>swimming, water exercise, aquatic therapy and relaxation. </li>    <li><strong>It costs</strong> about the same to operate as a hot tub. </li>    <li><strong>All parts of the kit can fit </strong>through doorways as narrow as 24 inches, making it ideal for installations in existing spaces like basements and garages. </li>    <li><strong>The entire Endless Pools system has been ETL listed </strong>after passing rigorous tests for electrical and other safety standards. </li>    <li><strong>When the swimming pool is covered,</strong> very little humidity escapes into your indoor or outdoor space. </li>    <li><strong>Because of our innovative Water Quality System, </strong>the swimming pool is virtually odor free, even indoors. </li>    <li><strong>The small size means the pool is inherently more efficient </strong>- less water to heat, less water to keep clean. </li> </ul>  <p>Below I have a bunch of links I’ve collected over the last few months related to the Endless Pool – I thought someone might find it interesting.</p>  <p><strong>Endless Pool Links</strong></p>  <p>These are a bunch of links related to the “Endless Pool” I’ve collected:</p>  <table border="0" cellspacing="0" cellpadding="2" width="648"><tbody>     <tr>       <td valign="top" width="197">Main Endless Pool website</td>        <td valign="top" width="449"><a title="http://www.endlesspools.com/" href="http://www.endlesspools.com/">http://www.endlesspools.com/</a></td>     </tr>      <tr>       <td valign="top" width="197">Endless Pool Gallery</td>        <td valign="top" width="449"><a title="http://www.endlesspools.com/gallery/index.html" href="http://www.endlesspools.com/gallery/index.html">http://www.endlesspools.com/gallery/index.html</a></td>     </tr>      <tr>       <td valign="top" width="197">How does the Endless Pool work</td>        <td valign="top" width="449"><a title="http://www.endlesspools.com/whatis/what_work.html" href="http://www.endlesspools.com/whatis/what_work.html">http://www.endlesspools.com/whatis/what_work.html</a></td>     </tr>      <tr>       <td valign="top" width="197">Possible Configurations</td>        <td valign="top" width="449"><a title="http://www.endlesspools.com/fti/popups/configurations.html" href="http://www.endlesspools.com/fti/popups/configurations.html">http://www.endlesspools.com/fti/popups/configurations.html</a></td>     </tr>      <tr>       <td valign="top" width="197">Endless Pool Installation Blog</td>        <td valign="top" width="449"><a title="http://ep.4bcj.com/default.aspx" href="http://ep.4bcj.com/default.aspx">http://ep.4bcj.com/default.aspx</a></td>     </tr>      <tr>       <td valign="top" width="197">Nature2 Purification System</td>        <td valign="top" width="449"><a title="http://www.nature2.com/about/" href="http://www.nature2.com/about/">http://www.nature2.com/about/</a></td>     </tr>      <tr>       <td valign="top" width="197">Endless Pools on ePinions.com</td>        <td valign="top" width="449"><a href="http://www1.epinions.com/reviews/The_Endless_Pool/sec_~opinion_list/pp_~1/pa_~1#list" target="_blank">Long Link</a>&#160;</td>     </tr>      <tr>       <td valign="top" width="197">Site for Endless Pool owners</td>        <td valign="top" width="449"><a title="http://myendlesspool.com/ " href="http://myendlesspool.com/ ">http://myendlesspool.com/ </a></td>     </tr>      <tr>       <td valign="top" width="197">Installation Proposal Template</td>        <td valign="top" width="449"><a title="http://www.endlesspools.com/contractor/pdfs/originalendlesspoolrfp.pdf" href="http://www.endlesspools.com/contractor/pdfs/originalendlesspoolrfp.pdf">http://www.endlesspools.com/contractor/pdfs/originalendlesspoolrfp.pdf</a></td>     </tr>      <tr>       <td valign="top" width="197">Shipping Information</td>        <td valign="top" width="449"><a title="https://www.endlesspoolswimspa.com/plan/plan_shipping.asp" href="https://www.endlesspoolswimspa.com/plan/plan_shipping.asp">https://www.endlesspoolswimspa.com/plan/plan_shipping.asp</a>           <br />Pool kit comes in 2 or 3 pallets, total weight around 2,000 lbs</td>     </tr>      <tr>       <td valign="top" width="197">Allied Van Lines</td>        <td valign="top" width="449"><a title="http://www.allied.com/" href="http://www.allied.com/">http://www.allied.com/</a> (official Endless Pools shipping company)</td>     </tr>      <tr>       <td valign="top" width="197">Escrow Services</td>        <td valign="top" width="449"><a title="https://www.escrow.com/" href="https://www.escrow.com/">https://www.escrow.com/</a> (suggested by eBay for large transactions)</td>     </tr>      <tr>       <td valign="top" width="197">San Mateo Swimming Pool Code</td>        <td valign="top" width="449"><a title="http://www.ci.sanmateo.ca.us/index.asp?NID=737" href="http://www.ci.sanmateo.ca.us/index.asp?NID=737">http://www.ci.sanmateo.ca.us/index.asp?NID=737</a></td>     </tr>   </tbody></table>]]>
   </content>
</entry>
<entry>
   <title>Modifying .netTiers templates to support Windows Azure configuration</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/09/modifying_nettiers_templates_t.html" />
   <id>tag:blog.ehuna.org,2009://9.331</id>
   
   <published>2009-09-28T23:05:00Z</published>
   <updated>2009-12-10T00:02:40Z</updated>
   
   <summary>My favorite ORM for .NET development is by far .netTiers (http://nettiers.com/) – a set of templates for CodeSmith (http://www.codesmithtools.com/) that create an awesome Business Logic Layer (BLL) and a Data Access Layer (DAL) in seconds. The .netTiers Application Framework: http://nettiers.com/...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>My favorite ORM for .NET development is by far .netTiers (<a title="http://nettiers.com/" href="http://nettiers.com/">http://nettiers.com/</a>) – a set of templates for CodeSmith (<a title="http://www.codesmithtools.com/" href="http://www.codesmithtools.com/">http://www.codesmithtools.com/</a>) that create an awesome Business Logic Layer (BLL) and a Data Access Layer (DAL) in seconds.</p>  <blockquote>   <p><a href="http://nettiers.com/" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/Mod.netTierstemplatestosupportWindowsAzu_E3CE/image.png" width="435" height="211" /></a>       <br />The .netTiers Application Framework: <a title="http://nettiers.com/" href="http://nettiers.com/">http://nettiers.com/</a></p> </blockquote>  <p>.netTiers uses a connection string to connect to a SQL Server database at runtime – it works with an on-premise SQL Server (e.g. SQL Server Express 2008) or a SQL Azure database in the cloud.&#160; Out of the box, .netTiers reads this connection string from a Web.config (or app.config) file.</p>  <p>Since Windows Azure has its configuration in ServiceConfiguration.cscfg, I modified the .netTiers 2.3 templates so at runtime our DAL reads the connection string from the correct place.</p>  <p>Thanks to SuperJeffe who gave me the pointer in <a href="http://community.codesmithtools.com/forums/t/10124.aspx" target="_blank">this thread</a> on what changes were needed.&#160; Below you can find my notes on what changes were made to the .netTiers templates and you can download the modified templates as well.</p> ]]>
      <![CDATA[  <p><strong>Modifying .netTiers templates to support Windows Azure configuration</strong></p> <em><strong>Download files:     <br /></strong>If using the Windows Azure SDK from <strong>November 2009 or later</strong>, download the modified .netTiers 2.3 templates here:     <br /></em><a title="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip" href="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip"><em>http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip</em></a>  <p><em>If using the Windows Azure SDK from <strong>October 2009 or earlier</strong>, download the modified .netTiers 2.3 templates here:       <br /></em><a title="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip" href="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip" target="_blank"><em>http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip</em></a></p>  <p>If you use these modified .netTiers 2.3 templates, it is very easy to get your DAL working in Windows Azure.&#160; Once you download the modified templates and follow the installation instructions below, you’ll see I modified the .netTiers templates and added a &quot;IsConnectionStringAzure&quot; property:</p>  <p><i>&lt;%@ Property Name=&quot;IsConnectionStringAzure&quot; Type=&quot;System.Boolean&quot; Default=&quot;False&quot; Category=&quot;02. Framework Generation - Optional&quot; Description=&quot;Indicates if at runtime the netTiersConnectionString is read from Window Azure's ServiceConfiguration.cscfg or from Web.config/app.config.&quot; %&gt;</i></p>  <p>Just set &quot;IsConnectionStringAzure&quot; to &quot;true&quot; (the default is &quot;false&quot;) and at runtime, your DAL will read from Windows Azure configuration instead of web.config (or app.config).&#160; When creating a new Windows Azure project, add this to your ServiceDefinition.csdef file:</p>  <p>&#160;&#160;&#160; &lt;ConfigurationSettings&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;Setting name=&quot;netTiersConnectionString&quot; /&gt;     <br />&#160;&#160;&#160; &lt;/ConfigurationSettings&gt;</p>  <p>And then in your ServiceConfiguration.cscfg add this:</p>  <p>&#160;&#160;&#160; &lt;ConfigurationSettings&gt;    <br />&#160;&#160;&#160;&#160;&#160; &lt;Setting name=&quot;netTiersConnectionString&quot; value=&quot;Server=tcp:MYSQLAZURESERVER.ctp.database.windows.net;Database=master;User ID=MYLOGIN;Password=MYPASSWORD;Trusted_Connection=False;&quot; /&gt;     <br />&#160;&#160;&#160; &lt;/ConfigurationSettings&gt;</p>  <p>Your netTiersConnectionString can be your regular connection string that point to a local on-premise SQL Server database (for development), or a SQL Azure database when you deploy to the Windows Azure cloud (Staging or Production).</p>  <p>I attach the changes to the .netTiers 2.3 templates I made and below I describe in detail the actual changes.</p>  <p>I also have a series of videos I've created that cover Windows Azure, SQL Azure and how to use .netTiers with both – you can see the index here:</p>  <p>&#160; Windows Azure and SQL Azure Videos   <br />&#160; <a title="http://blog.ehuna.org/2009/09/windows_azure_and_sql_azure_vi.html" href="http://blog.ehuna.org/2009/09/windows_azure_and_sql_azure_vi.html">http://blog.ehuna.org/2009/09/windows_azure_and_sql_azure_vi.html</a>&#160;</p>  <p>Thanks to my co-workers, Arif and Lanh, who helped me think through the steps we needed to implement to make this work.</p>  <p>Good times!</p>  <p>Emmanuel Huna    <br /><em>Check out our personal site at </em><a href="http://www.ehuna.org"><em>http://www.ehuna.org</em></a>    <br /><em>Follow me on <a href="http://twitter.com/ehuna">http://twitter.com/ehuna</a> </em></p>  <p>   <br /><em><strong>Download files:       <br /></strong>If using the Windows Azure SDK from <strong>November 2009 or later</strong>, download the modified .netTiers 2.3 templates here:       <br /></em><a title="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip" href="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip"><em>http://www.ehuna.org/files/NetTiers-Support-Windows-Azure-SDK-200911.zip</em></a> </p>  <p><em>If using the Windows Azure SDK from <strong>October 2009 or earlier</strong>, download the modified .netTiers 2.3 templates here:       <br /></em><a title="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip" href="http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip" target="_blank"><em>http://www.ehuna.org/files/NetTiers-Support-Windows-Azure.zip</em></a></p>  <p>   <br /><strong>Info on NetTiers-Support-Windows-Azure-SDK-200911.zip (Azure SDK 2009/11 or later)</strong></p>  <blockquote>   <p><em>Here's what you'll find in the ZIP file: </em></p>    <p><em>&#160; 01-readme.txt - this file.       <br />&#160; 02-NetTiers-Azure-SDK-200911-Support-Template-Changes.txt - a log of the changes I made to the .netTiers 2.3 templates so out of the box your data access layer works with Windows Azure November 2009 SDK configuration (ServiceConfiguration.cscfg). </em></p>    <p><em>Inside the &quot;NetTiers&quot; folder you find: </em></p>    <p><em>&#160; \NetTiers.cst - changes to the main .netTiers template </em></p>    <p><em>&#160; \NetTiers\DataAccessLayer\DataRepository.cst - Changes to the DataRepository.cst template. </em></p>    <p><em>&#160; \NetTiers\References\ - AzureSDKv1_0_200911\Microsoft.WindowsAzure.ServiceRuntime.dll - Copy this folder and DLL to your NetTiers\References folder.&#160; In the future we can add support for different versions of Windows Azure (currently there's only v1.0). </em></p>    <p><em>&#160; \NetTiers\VisualStudio\vsnet2005.project.cst - Changes to the vsnet2005.project.cst template.&#160; When &quot;IsConnectionStringAzure&quot; to &quot;true&quot;, I add a reference to Microsoft.WindowsAzure.ServiceRuntime.dll so at runtime I can read the &quot;netTiersConnectionString&quot; from the Windows Azure configuration file (&quot;ServiceConfiguration.cscfg&quot;).</em></p> </blockquote>  <p><strong>Info on NetTiers-Support-Windows-Azure.zip (Azure SDK 2009/10 or earlier)</strong></p>  <blockquote>   <p><em>Here's what you'll find in the ZIP file:</em></p>    <p><em>\doc        <br />&#160; 01-Readme-NetTiers-Azure-Support-Code-Changes.txt - a log of the changes I made in the original (generated) C# code.         <br />&#160; 02-Readme-NetTiers-Azure-Support-Template-Changes.txt - a log of the changes I made to the .netTiers 2.3 templates.&#160; I also copy it below.</em></p>    <p><em>\NetTiers.cst - changes to the main .netTiers template.&#160; Copy this file over your NetTiers.cst template.</em></p>    <p><em>\NetTiers\References\        <br />&#160; AzureSDKv1_0\Microsoft.ServiceHosting.ServiceRuntime.dll - Copy this folder and DLL to your NetTiers\References folder.&#160; In the future we can add support for different versions of Windows Azure (currently there's only v1.0).</em></p>    <p><em>\NetTiers\DataAccessLayer\DataRepository.cst - Changes to the DataRepository.cst template, copy this file over your DataAccessLayer\DataRepository.cst template.</em></p>    <p><em>\NetTiers\VisualStudio\vsnet2005.project.cst - Changes to the vsnet2005.project.cst template.&#160; When &quot;IsConnectionStringAzure&quot; to &quot;true&quot;, I add a reference to Microsoft.ServiceHosting.ServiceRuntime.dll so at runtime I can read the &quot;netTiersConnectionString&quot; from the Windows Azure configuration file (&quot;ServiceConfiguration.cscfg&quot;).&#160; Copy this file over your VisualStudio\vsnet2005.project.cst template.</em></p> </blockquote>  <p><strong>Detailed description of the changes that were made to the .netTiers templates (November 2009 or later)</strong></p>  <p>1) Copied    <br />&#160; C:\Program Files\Windows Azure SDK\v1.0\ref    <br />&#160;&#160;&#160; Microsoft.WindowsAzure.ServiceRuntime.dll    <br />&#160;&#160;&#160; Microsoft.WindowsAzure.ServiceRuntime..xml    <br />&#160; to    <br />&#160; \NetTiers\References\AzureSDKv1_0_200911 </p>  <p>2) Edited NetTiers.cst:   <br />&#160; After line 1303:    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\nunit.framework.dll&quot;, libPath + &quot;\\nunit.framework.dll&quot;);    <br />&#160; Add:    <br />&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\nunit.framework.dll&quot;, libPath + &quot;\\nunit.framework.dll&quot;);    <br />&#160;&#160;&#160; if(IsConnectionStringAzure)    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\AzureSDKv1_0_200911\\Microsoft.WindowsAzure.ServiceRuntime.dll&quot;, libPath + &quot;\\Microsoft.WindowsAzure.ServiceRuntime.dll&quot;);    <br />&#160;&#160;&#160; } </p>  <p>3) Edited NetTiers\VisualStudio\vsnet2005.project.cst:   <br />&#160; After line 258:    <br />&#160;&#160;&#160; &lt;ItemGroup&gt;    <br />&#160; Add:    <br />&#160;&#160;&#160;&#160;&#160; &lt;% if (IsConnectionStringAzure) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Reference Include=&quot;Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;HintPath&gt;..\References\Microsoft.WindowsAzure.ServiceRuntime.dll&lt;/HintPath&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Reference&gt;    <br />&#160;&#160;&#160; &lt;%}%&gt; </p>  <p>4) Edited NetTiers\DataAccessLayer\DataRepository.cst   <br />&#160;&#160;&#160; After line 24:    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; using &lt;%=DALNameSpace%&gt;.Bases;    <br />&#160;&#160;&#160; Add:    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; using &lt;%=DALNameSpace%&gt;.Bases;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IsConnectionStringAzure ) { %&gt;    <br />&#160;&#160;&#160; using Microsoft.WindowsAzure.ServiceRuntime;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } %&gt; </p>  <p>5) Edited NetTiers\DataAccessLayer\DataRepository.cst </p>  <p>&#160;&#160;&#160; Replace in line 299, collection ConnectionStrings:   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static ConnectionStringSettingsCollection ConnectionStrings    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; get    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // use default ConnectionStrings if _section has already been discovered    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( _config == null &amp;&amp; _section != null )    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Configuration.ConnectionStrings.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>&#160;&#160;&#160; With:   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static ConnectionStringSettingsCollection ConnectionStrings    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; get    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IsConnectionStringAzure ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ConnectionStringSettingsCollection oConnectionStrings = new ConnectionStringSettingsCollection();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ConnectionStringSettings oSettings = new ConnectionStringSettings();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oSettings.Name = &quot;netTiersConnectionString&quot;;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (RoleEnvironment.IsAvailable)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oSettings.ConnectionString = RoleEnvironment.GetConfigurationSettingValue(&quot;netTiersConnectionString&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oConnectionStrings.Add(oSettings);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return oConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // use default ConnectionStrings if _section has already been discovered    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( _config == null &amp;&amp; _section != null )    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Configuration.ConnectionStrings.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // use default ConnectionStrings if _section has already been discovered    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( _config == null &amp;&amp; _section != null )    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Configuration.ConnectionStrings.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IncludeDesignTimeSupport ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IsConnectionStringAzure ) { %&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>Note that the 2009-11 Azure SDK allows us to check whether we are running inside Windows Azure (through &quot;RoleEnvironment.IsAvailable&quot;) - we make this check to allow us to run our web roles inside the Azure local development fabric or directly in IIS (not in Azure).</p>  <p><strong>Detailed description of the changes that were made to the .netTiers templates (October 2009 or earlier)</strong></p>  <p>1) Copied&#160; <br />&#160; C:\Program Files\Windows Azure SDK\v1.0\ref     <br />&#160;&#160;&#160; Microsoft.ServiceHosting.ServiceRuntime.dll     <br />&#160;&#160;&#160; Microsoft.ServiceHosting.ServiceRuntime.xml     <br />&#160; to     <br />&#160; \NetTiers\References\AzureSDKv1_0     <br />    <br />2) Edited NetTiers.cst:     <br />&#160;&#160;&#160; Add under &lt;%-- 2. Framework Generation Category --%&gt;     <br />&#160;&#160;&#160; &lt;%@ Property Name=&quot;IsConnectionStringAzure&quot; Type=&quot;System.Boolean&quot; Default=&quot;False&quot; Category=&quot;02. Framework Generation - Optional&quot; Description=&quot;Indicates if at runtime the netTiersConnectionString is read from Window Azure's ServiceConfiguration.cscfg or from Web.config/app.config.&quot; %&gt;     <br />    <br />3) Edited NetTiers\DataAccessLayer\DataRepository.cst and add:     <br />&lt;%@ Property Name=&quot;IsConnectionStringAzure&quot; Type=&quot;System.Boolean&quot; Default=&quot;False&quot; Category=&quot;02. Framework Generation - Optional&quot; Description=&quot;Indicates if at runtime the netTiersConnectionString is read from Window Azure's ServiceConfiguration.cscfg or from Web.config/app.config.&quot; %&gt;     <br />    <br />4) Edited NetTiers\VisualStudio\vsnet2005.project.cst     <br />&lt;%@ Property Name=&quot;IsConnectionStringAzure&quot; Type=&quot;System.Boolean&quot; Default=&quot;False&quot; Category=&quot;02. Framework Generation - Optional&quot; Description=&quot;Indicates if at runtime the netTiersConnectionString is read from Window Azure's ServiceConfiguration.cscfg or from Web.config/app.config.&quot; %&gt;     <br />    <br />5) Edited NetTiers.cst:     <br />&#160;&#160; After line 1904:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(&quot;DataRepository.cst&quot;).SetProperty(&quot;VisualStudioVersion&quot;, VisualStudioVersion);     <br />&#160;&#160; Add:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(&quot;DataRepository.cst&quot;).SetProperty(&quot;VisualStudioVersion&quot;, VisualStudioVersion);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(&quot;DataRepository.cst&quot;).SetProperty(&quot;IsConnectionStringAzure&quot;, IsConnectionStringAzure);     <br />    <br />6) Edit NetTiers.cst:     <br />&#160;&#160; After line 2822:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(projectTemplate).SetProperty(&quot;ValidationType&quot;, ValidationType);     <br />&#160;&#160;&#160;&#160;&#160; Add:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(projectTemplate).SetProperty(&quot;ValidationType&quot;, ValidationType);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.GetTemplate(projectTemplate).SetProperty(&quot;IsConnectionStringAzure&quot;, IsConnectionStringAzure);     <br />    <br />7) Edited NetTiers.cst:     <br />&#160; After line 1303:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\nunit.framework.dll&quot;, libPath + &quot;\\nunit.framework.dll&quot;);     <br />&#160; Add:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\nunit.framework.dll&quot;, libPath + &quot;\\nunit.framework.dll&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(IsConnectionStringAzure)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SafeCopyFile(this.CodeTemplateInfo.DirectoryName + &quot;\\References\\AzureSDKv1_0\\Microsoft.ServiceHosting.ServiceRuntime.dll&quot;, libPath + &quot;\\Microsoft.ServiceHosting.ServiceRuntime.dll&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />8) Edited NetTiers\VisualStudio\vsnet2005.project.cst:     <br />&#160; After line 258:     <br />&#160;&#160;&#160; &lt;ItemGroup&gt;     <br />&#160; Add:     <br />&#160;&#160;&#160;&#160;&#160; &lt;% if (IsConnectionStringAzure) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Reference Include=&quot;Microsoft.ServiceHosting.ServiceRuntime, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL&quot;&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;HintPath&gt;..\References\Microsoft.ServiceHosting.ServiceRuntime.dll&lt;/HintPath&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Reference&gt;     <br />&#160;&#160;&#160; &lt;%}%&gt;     <br />    <br />9) Edited NetTiers\DataAccessLayer\DataRepository.cst     <br />&#160;&#160;&#160; After line 24:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; using &lt;%=DALNameSpace%&gt;.Bases;     <br />&#160;&#160;&#160; Add:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; using &lt;%=DALNameSpace%&gt;.Bases;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IsConnectionStringAzure ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; using Microsoft.ServiceHosting.ServiceRuntime;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } %&gt;     <br />    <br />10) Edited NetTiers\DataAccessLayer\DataRepository.cst     <br />&#160;&#160;&#160; Replace in line 299, collection ConnectionStrings:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static ConnectionStringSettingsCollection ConnectionStrings     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; get     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IncludeDesignTimeSupport ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // use default ConnectionStrings if _section has already been discovered     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( _config == null &amp;&amp; _section != null )     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Configuration.ConnectionStrings.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IncludeDesignTimeSupport ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160; With:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static ConnectionStringSettingsCollection ConnectionStrings     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; get     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IsConnectionStringAzure ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ConnectionStringSettingsCollection oConnectionStrings = new ConnectionStringSettingsCollection();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ConnectionStringSettings oSettings = new ConnectionStringSettings();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oSettings.Name = &quot;netTiersConnectionString&quot;;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oSettings.ConnectionString = RoleManager.GetConfigurationSetting(&quot;netTiersConnectionString&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oConnectionStrings.Add(oSettings);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return oConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% if ( IncludeDesignTimeSupport ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // use default ConnectionStrings if _section has already been discovered     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( _config == null &amp;&amp; _section != null )     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return Configuration.ConnectionStrings.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } else { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return WebConfigurationManager.ConnectionStrings;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IncludeDesignTimeSupport ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;% } // end if ( IsConnectionStringAzure ) { %&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p>Good times!</p>]]>
   </content>
</entry>
<entry>
   <title>Windows Azure and SQL Azure Videos</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/09/windows_azure_and_sql_azure_vi.html" />
   <id>tag:blog.ehuna.org,2009://9.323</id>
   
   <published>2009-09-26T18:23:00Z</published>
   <updated>2009-11-24T21:35:42Z</updated>
   
   <summary>In the past 2-3 weeks I’ve spent my time researching Microsoft&apos;s new cloud operating system, Windows Azure.&amp;#160; I just finished 3 days of meetings with my co-workers Arif and Lanh, where I gave them an overview on how to write...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>In the past 2-3 weeks I’ve spent my time researching Microsoft's new cloud operating system, Windows Azure.&#160; I just finished 3 days of meetings with my co-workers Arif and Lanh, where I gave them an overview on how to write code to target Windows Azure.&#160; </p>  <p>I thought it would be a good idea to publish these videos here and share them with the community – all of the content below is free.</p>  <blockquote>   <p><a href="http://blog.ehuna.org/liveimages/e47b483f9afe_9C3C/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/e47b483f9afe_9C3C/image_thumb.png" width="341" height="238" /></a>       <br />Windows Azure: Microsoft's new &quot;Cloud Operating System&quot; </p> </blockquote>  <p>We also covered the new SQL Server in the cloud, SQL Azure, and ways to make calls to SQL Azure using the .netTiers ORM and ADO.NET.&#160; </p>  <p><strong>We ended up with 7 videos, over 4 hours of content and over 90 items covered!&#160; </strong>You can access all of the videos using the links below.</p>  <p>If you’d like to follow along and copy/paste code as you watch the videos, I have posted the source code to all samples seen in the video on Codeplex:</p>  <blockquote>   <p>CloudService1 - Windows Azure and SQL Azure samples      <br /><a title="http://cloudservice1.codeplex.com/" href="http://cloudservice1.codeplex.com/">http://cloudservice1.codeplex.com/</a></p> </blockquote>  <p>You'll also need a the Windows Azure SDK v1.0 (September CTP) installed – you can get it from the <a href="http://msdn.microsoft.com/en-us/azure/default.aspx" target="_blank">Windows Azure Developer Center</a> on the Microsoft Developer Network (MSDN).&#160; You can also download the <a href="http://www.microsoft.com/web/Downloads/platform.aspx" target="_blank">Web Platform Installer 2.0</a> – which will setup everything you need to start coding on Windows Azure.&#160; </p>  <p><strong>Update 11/24/2009</strong>: Microsoft released a new version of the Windows Azure SDK – the “November 2009” CTP – and changed many of the APIs we were using in earlier versions of the Azure SDK.&#160; Much of the Azure specific APIs covered in the videos below apply to the October 2009 Windows Azure SDK (or earlier versions).</p>  <p>See below for links and descriptions to all videos.</p> ]]>
      <![CDATA[  <p><strong>Windows Azure and SQL Azure Videos      <br /></strong>by Emmanuel Huna</p>  <p><strong>Windows Azure Overview - Part 1 </strong>(31 minutes)<strong>      <br /></strong><a title="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_1.html" href="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_1.html" target="_blank">http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_1.html</a>     <br />    <br />1. Overview of Windows Azure.     <br />2. Using the virtual machine with the Windows Azure SDK.     <br />3. Creating a cloud service project.     <br />4. Adding web roles and worker roles.     <br />5. Azure service definition and service configuration.     <br />6. Input endpoints (HTTP and HTTPS) and multiple role instances.     <br />7. Custom ASP.NET Session provider that uses Azure storage.     <br />8. Azure Storage client library.     <br />9. Azure storage - blobs, queues and messages.     <br />10. Development fabric.     <br />11. Development storage.     <br />12. Writing to the Azure log.     <br />13. Loading parameters when your role starts.     <br />14. Running roles in full trust.</p>  <p>Windows Azure Overview - Part 2 (63 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_2.html" href="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_2.html">http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_2.html</a>     <br />    <br />Note: we lost sound in the last 25 minutes - you get the Allman brothers instead.     <br />15. Worker Role health status.     <br />16. Custom ASP.NET Session provider that uses Azure storage - configuration in both Azure files and web.config/app.config.     <br />17. Windows Azure portal.     <br />18. Windows Live IDs and Azure CTP.     <br />19. CS (Cloud Service) packages and Azure configuration.     <br />20. Azure Storage Accounts.     <br />21. Azure Staging and Production Environments.     <br />22. Deployment IDs.     <br />23. Staging DNS entries.     <br />24. Upgrade/Run/Suspend/Configure/Delete commands.     <br />25. Initialized/Running/Stopped/Paused role instance states.     <br />26. Billing considerations when instances are deployed.     <br />27. Azure Storage Manager.     <br />28. Custom error pages in ASP.NET.     <br />29. Azure training kit labs.     <br />30. Azure links.     <br />31. Azure Service Management API.     <br />32. Azure SDK Tools documentation and CSPack/CSRun Azure command line tools.     <br />33. Doing a Staging Upgrade.     <br />34. Serving dynamic compressed content in Azure and bug on Microsoft Connect. </p>  <p>Windows Azure Overview - Part 3 (20 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_3.html" href="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_3.html">http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_3.html</a></p>  <p>   <br />35. Using the Windows Azure forums and getting feedback from Microsoft employees.     <br />36. Loading parameters when role starts.     <br />37. Using reflection to log the role's version.     <br />38. Page_Init() calls that should always be made.</p>  <p>Windows Azure Overview - Part 4 (55 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_4.html" href="http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_4.html">http://screencasts.ehuna.org/2009/09/windows_azure_overview_part_4.html</a></p>  <p>   <br />39. Unhandled exceptions and custom errors in Web.Config.     <br />40. Handling Upgrades: making sure the roles properly act when we are upgrading SQL Azure.     <br />41. Loading a Windows Azure Storage Queue endpoint (QueueEndPointURI, AccountName, AccountSharedKey, StorageAccountInfo).     <br />42. Creating a persistent and stateless Azure Storage Queue (QueueStorage and MessageQueue).     <br />43. Adding an event to a queue in a web role.     <br />44. Handling the event from a queue in a worker role.     <br />45. Properly returning RoleStatus.Healthy or RoleStatus.UnHealthy in a worker's role GetHealthStatus() to allow for better monitoring of our role instances.     <br />46. Considerations in removing a message from a queue when an error occurs (examples where message should be deleted and should not be deleted when sending out an email).     <br />47. Logging Levels in the Development Fabric UI (Critical, Error, Warning, Information and Debugging).     <br />48. Windows Azure Storage labs in the Azure training kit (to cover blobs and tables).     <br />49. DNS considerations with Windows Azure URLs (CNAME entries).     <br />50. Self signed SSL certificates for Windows Azure development (see <a href="onenote://ehuna1r2/OneNote/CEP/Misc.one#Azure%20Links&amp;section-id=%7B2BBD417C-9FA3-41F3-A8A3-1179E65E93D8%7D&amp;page-id=%7B56DD9B3B-7C2E-4E63-8E36-F681E377B2C6%7D&amp;end">Azure Links</a>, OneNote required).     <br />51. Adding purchased SSL certificates to your Windows Azure project.</p>  <p>SQL Azure Overview - Part 1 (48 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_1.html" href="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_1.html">http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_1.html</a></p>  <p>   <br />52. Overview of SQL Azure.     <br />53. Warning on name changes and confusing documentation (e.g. SQL Azure was previously called &quot;SDS&quot;, SQL Data Services).     <br />54. SQL Azure CTP limits: 5 databases, 10 GB per Windows Live Account.&#160; MyCalyx Windows Live account: <a href="mailto:cloudservice2@calyxsoftware.com">cloudservice2@calyxsoftware.com</a>     <br />55. SQL Azure Connection Strings for ADO.NET, ODBC, and OLE DB.&#160; Our ORM of choice, .netTiers, uses the ADO.NET connection string.     <br />56. The &quot;sa&quot; account in SQL Azure.     <br />57. Using SQL Management Studio to manage SQL Azure databases.&#160; SQL Azure server names, errors and warnings to currently ignore.     <br />58. TDS - Tabular Data Stream protocol on port 1433.     <br />59. Useful &quot;manual&quot; SQL statements.     <br />60. Cleaning up SQL scripts for SQL Azure - including <a href="http://blog.ehuna.org/2009/08/cleaning_up_scripts_for_sql_az.html">link to my blog entry</a>.     <br />61. Another blog entry I wrote with PowerShell scripts to clean up SQL scripts for SQL Azure: <a href="http://blog.ehuna.org/2009/08/windows_powershell_commands_to.html">http://blog.ehuna.org/2009/08/windows_powershell_commands_to.html</a>     <br />62. Creating new databases in SQL Azure - having separate SQL Azure databases for Staging and Production.&#160; Continue using on-premise SQL Server for development.     <br />63. Types of SQL Azure databases when v1.0 rolls out: Web Edition (1 GB max, $9.99/month) and Business Edition (10 GB max, $99.99/month).     <br />64. Creating a specific Login and User for every database (do not use the &quot;sa&quot; account).     <br />65. Creating a sample database (TESTDB1) on an on-premise SQL Server 2008 Standard and deploying it to SQL Azure.     <br />66. Important: you need at least one primary key - clustered index - before you can insert any records in a SQL Azure table (good and also works well with the .netTiers model).     <br />67. Options to change in SQL Server Management Studio &gt; TESTDB1 &gt; Tasks &gt; Generate Scripts (due to currently unsupported features in SQL Azure).     <br />68. Handling SQL Azure timeouts in SQL Server Management Studio.     <br />69. A better way: the new &quot;SQL Azure Migration Wizard&quot; <a href="http://sqlazuremw.codeplex.com/">released on CodePlex</a>.&#160; Installing it, configuring it and using it.&#160; Automatic cleaned up scripts for SQL Azure including tables, stored procedures, primary keys, foreign keys, indexes, etc.     <br />70. RedGate SQL Compare and <a href="http://www.red-gate.com/MessageBoard/viewtopic.php?t=9463">my feeble lobbying attempt</a> to get their developers to release a version that works on SQL Azure.     <br />71. Strategies for deploying a database on SQL Azure (first time) and options for schema changes and upgrades in future versions.</p>  <p>SQL Azure Overview - Part 2 (18 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_2_18_m.html" href="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_2_18_m.html">http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_2_18_m.html</a>     <br />    <br />72. Overview of CodeSmith (<a href="http://www.codesmithtools.com/">http://www.codesmithtools.com/</a>) and my favorite ORM tool, .netTiers (<a href="http://nettiers.com/">http://nettiers.com/</a>)     <br />73. Important .netTiers configuration settings - source database, output directory, enterprise library version, executing the SQL, SQL Server 2005 database features, layer names, and SignAssembly.     <br />74. Creating the Business Logic Layer (BLL) and Data Access Layer (DAL) for our previously TESTDB1 sample database.     <br />75. The .netTiers report: which C# classes were created - with one table we got 64 objects + all of the Stored Procedures.     <br />76. Compiling the generated business layer.     <br />77. Copying the binaries (compiled DLLs) to a middle tier folder in source control.&#160; Makes it easier for other developers to use our projects.     <br />78. Adding references to the middle tier DLLs to your Windows Azure projects so they are properly deployed to Staging/Production.     <br />79. The .netTiers SQL Client provider and configuration settings in Web.Config (or app.config).     <br />80. Using .netTiers dynamic connections to connect to a SQL Azure database at runtime.     <br />81. Sample ASP.NET page that uses DataRepository to bind records from sample table (TstMessages) in TESTDB1.&#160; Also uses Ajax (update panel and trigger).     <br />82. Idea: sub-classing the System.Web.UI.Page to automatically check if parameters are loaded, check on upgrades and create the .netTiers dynamic connection string.     <br />83. Loading the netTiersConnectionString from Windows Azure configuration.     <br />84. Using a short constant for the dynamic connection string name (to simplify the already elongated code).     <br />85. .netTiers community forums and a <a href="http://community.codesmithtools.com/forums/t/10124.aspx">thread I started on dynamic connection strings</a>.&#160; We get a tip on how to modify the .netTiers templates to add built-in support for Windows Azure and SQL Azure. </p>  <p>SQL Azure Overview - Part 3 (15 minutes)    <br /><a title="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_3_15_m.html" href="http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_3_15_m.html">http://screencasts.ehuna.org/2009/09/sql_azure_overview_part_3_15_m.html</a>     <br />    <br />86. Modifying the .netTiers templates to read the SQL connection string from Windows Azure configuration instead of Web.Config (or app.config).     <br />87. How the code looks in the ASP.NET page - it doesn't change, it's the same &quot;DataRepository.MyTableProvider&quot; code we've used in the past.     <br />88. Changes in the DataRepository.cst template - changing the ConnectionString collection.     <br />89. Item for Lanh: making sure all .netTiers templates use &quot;connectionString&quot; from this collection.     <br />90. The process of creating custom features in CodeSmith templates: first make the changes in the code, then make the changes in the templates.     <br />91. Details of what was executed to modify the .netTiers 2.3 templates to support reading the netTiersConnectionString from Windows Azure configuration using the Windows Azure SDK v1.0.&#160; We now have a &quot;IsConnectionStringAzure&quot; property in the main NetTiers.cst templates!</p>  <p>Good times!</p>]]>
   </content>
</entry>
<entry>
   <title><![CDATA[Tested .netTiers with SQL Azure &ndash; it just works]]></title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/09/tested_nettiers_with_sql_azure.html" />
   <id>tag:blog.ehuna.org,2009://9.322</id>
   
   <published>2009-09-05T16:26:36Z</published>
   <updated>2009-09-06T01:01:51Z</updated>
   
   <summary>A few days ago Microsoft released a “Community Technology Preview” of SQL Azure, a hosted version of Microsoft SQL Server 2008.&amp;#160; In addition to the SQL Azure CTP, Microsoft also has a CTP for Windows Azure, where you can deploy...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p>A few days ago Microsoft released a “Community Technology Preview” of SQL Azure, a hosted version of Microsoft SQL Server 2008.&#160; In addition to the SQL Azure CTP, Microsoft also has a CTP for Windows Azure, where you can deploy web and worker roles – similar to how we deploy ASP.NET web sites and Windows Services today.&#160; For more information check out <a title="http://www.microsoft.com/azure/" href="http://www.microsoft.com/azure/">http://www.microsoft.com/azure/</a>.</p>  <p>A few weeks back I had started a thread on .netTiers and Azure:</p>  <p>&#160; .netTiers and Windows Azure?    <br />&#160; <a href="http://community.codesmithtools.com/forums/p/9327/37238.aspx">http://community.codesmithtools.com/forums/p/9327/37238.aspx</a></p>  <p>At the time only &quot;Azure Storage&quot; was available - Azure storage has support for Blobs, queues and &quot;Tables&quot;.&#160; Tables are not the tables we are used to in our relational databases and it would have been very difficult to have .netTiers work out of the box.</p>  <p>Well, now that the SQL Azure CTP is out, I tried to create a project that used .netTiers and its BLL and DAL to work with data in SQL Azure.&#160; It works!</p>  <p>Here's the process:</p>  <ol>   <li>Work on an on-premise SQL Server - create your schema, indexes, foreign keys and custom stored procs, etc... just like you do today.&#160; </li>    <li>At design time, use CodeSmith and generate your .netTiers DAL and BLL based on your on-premise SQL Server schema, like you do today. </li>    <li>At run-time, in development: use your on premise SQL Server or your SQL Azure SQL server - they both work by simply changing your connection string! </li>    <li>At run-time, in the Azure Cloud (Staging/Production): use SQL Azure </li> </ol>  <p>Your web and worker roles must run in full trust for the .netTiers DAL/BLL to work.&#160; In your Azure service definition, make sure you set enableNativeCodeExecution to &quot;true&quot; - something like:</p>  <p>&#160; &lt;WebRole name=&quot;MYPROJECT_WebRole&quot; enableNativeCodeExecution=&quot;true&quot;&gt;</p>  <p>Also, currently when creating your database, indexes, stored procs, etc... in SQL Azure, you'll need to manually generate a script in SSMS and then clean it up before running it in SQL Azure - I blogged about it here:</p>  <p>&#160; Cleaning up scripts for SQL Azure    <br />&#160; <a href="http://blog.ehuna.org/2009/08/cleaning_up_scripts_for_sql_az.html">http://blog.ehuna.org/2009/08/cleaning_up_scripts_for_sql_az.html</a></p>  <p>Here's what I've tried so far:</p>  <ul>   <li>Using .netTiers inside the Azure &quot;Development Fabric&quot; and connecting to a local on-premise SQL Server. </li>    <li>Using .netTiers inside the Azure &quot;Development Fabric&quot; and connecting to a SQL Azure database in the cloud. </li>    <li>Using .netTiers in a web role in the Azure Cloud connecting to a SQL Azure database in the cloud. </li> </ul>  <p>All I had to do to make the above work is to change my connection string - no need to change code!&#160; Good times!&#160; Below I copy my Windows Azure configuration file and give you an example on how to change your .netTiers connections string dynamically when it’s deployed to the Azure cloud.</p>  <p>Note: I originally posted these good news <a href="http://community.codesmithtools.com/forums/p/10093/37475.aspx" target="_blank">at the .netTiers forums</a> – I thought it would be a good idea to cross post it here as well.</p> ]]>
      <![CDATA[  <p><strong>.netTiers Dynamic Connection Strings     <br /></strong>    <br />When you deploy a Web Role (an ASP.NET web site or web service) to Windows Azure, you cannot change the web.config file. </p>  <p>Instead, Windows Azure allows you to change its internal configuration files.&#160; Such changes cause your Azure web roles to restart, just like changes to the web.config file cause your standard ASP.NET web sites and web services to reload.&#160; </p>  <p>In the Azure configuration files (ServiceDefinition.csdef and ServiceConfiguration.cscfg), I have defined a setting called &quot;NetTiersConnectionString&quot;:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">ServiceDefinition</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;MYPROJECTAzure&quot;</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">WebRole</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;MYPROJECT_WebRole&quot;</span> <span style="color: #ff0000">enableNativeCodeExecution</span><span style="color: #0000ff">=&quot;true&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">InputEndpoints</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>       <span style="color: #008000">&lt;!-- Must use port 80 for http and port 443 for https when running in the cloud --&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">InputEndpoint</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;HttpIn&quot;</span> <span style="color: #ff0000">protocol</span><span style="color: #0000ff">=&quot;http&quot;</span> <span style="color: #ff0000">port</span><span style="color: #0000ff">=&quot;8080&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">InputEndpoints</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">ConfigurationSettings</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setting</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;NetTiersConnectionString&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ConfigurationSettings</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">WebRole</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ServiceDefinition</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> <span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span>?<span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">ServiceConfiguration</span> <span style="color: #ff0000">serviceName</span><span style="color: #0000ff">=&quot;MYPROJECTAzure&quot;</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Role</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;MYPROJECT_WebRole&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Instances</span> <span style="color: #ff0000">count</span><span style="color: #0000ff">=&quot;2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">ConfigurationSettings</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setting</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;NetTiersConnectionString&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;Server=tcp:MYSQLAZURESERVER.ctp.database.windows.net;Database=master;User ID=MYLOGIN;Password=MYPASSWORD;Trusted_Connection=False;&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF--><!--CRLF--><!--CRLF--><!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ConfigurationSettings</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Role</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">ServiceConfiguration</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>Then, in each of my pages I use this connection string like this - I first add the connection when the page is loaded:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">Private</span> <span style="color: #0000ff">Sub</span> Page_Init(<span style="color: #0000ff">ByVal</span> sender <span style="color: #0000ff">As</span> <span style="color: #0000ff">Object</span>, <span style="color: #0000ff">ByVal</span> e <span style="color: #0000ff">As</span> System.EventArgs) <span style="color: #0000ff">Handles</span> <span style="color: #0000ff">Me</span>.Init</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>   DataRepository.AddConnection(<span style="color: #006080">&quot;MYCONNECTION&quot;</span>, sNetTiersConnectionString)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">End</span> Sub</pre>
<!--CRLF--></div>
</div>

<p>In other places in the page, I use the dynamic connection - for example like this:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> DataRepository.Connections(<span style="color: #006080">&quot;MYCONNECTION&quot;</span>).Provider.MYENTITYProvider.Insert(oMYENTITY)</pre>
<!--CRLF--></div>
</div>

<p></p>

<p>Finally in the page's unload event handler, I remove the connection:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">Private</span> <span style="color: #0000ff">Sub</span> Page_Unload(<span style="color: #0000ff">ByVal</span> sender <span style="color: #0000ff">As</span> <span style="color: #0000ff">Object</span>, <span style="color: #0000ff">ByVal</span> e <span style="color: #0000ff">As</span> System.EventArgs) <span style="color: #0000ff">Handles</span> <span style="color: #0000ff">Me</span>.Unload</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     DataRepository.Connections.Remove(<span style="color: #006080">&quot;MYCONNECTION&quot;</span>)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>   <span style="color: #0000ff">End</span> Sub</pre>
<!--CRLF--></div>
</div>

<p>I <a href="http://community.codesmithtools.com/forums/t/10124.aspx" target="_blank">opened a thread</a> on the .netTiers forums and members of the .netTiers team (Blake and SuperJeffe) verified that there are no performance or stability issues in using .netTiers dynamic connections.</p>]]>
   </content>
</entry>
<entry>
   <title>Windows PowerShell commands to clean up scripts for SQL Azure</title>
   <link rel="alternate" type="text/html" href="http://blog.ehuna.org/2009/08/windows_powershell_commands_to.html" />
   <id>tag:blog.ehuna.org,2009://9.321</id>
   
   <published>2009-08-27T22:08:00Z</published>
   <updated>2009-09-02T05:33:12Z</updated>
   
   <summary>Update 9/1: George Huey released an amazing tool, the “SQL Azure Migration Wizard”!&amp;#160; Here’s more info: &amp;#160; SQL Azure Migration Wizard – Information and Screencast &amp;#160; http://blog.wadewegner.com/index.php/2009/09/01/sql-azure-migration-wizard/ &amp;#160; SQL Azure Migration Wizard – Source Code and Binaries &amp;#160; http://sqlazuremw.codeplex.com/ Good...</summary>
   <author>
      <name></name>
      <uri>www.ehuna.org</uri>
   </author>
         <category term="03 - Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blog.ehuna.org/">
      <![CDATA[<p><strong>Update 9/1</strong>: George Huey released an amazing tool, the “SQL Azure Migration Wizard”!&#160; Here’s more info:</p>  <p>&#160; SQL Azure Migration Wizard – Information and Screencast   <br />&#160; <a title="http://blog.wadewegner.com/index.php/2009/09/01/sql-azure-migration-wizard/" href="http://blog.wadewegner.com/index.php/2009/09/01/sql-azure-migration-wizard/">http://blog.wadewegner.com/index.php/2009/09/01/sql-azure-migration-wizard/</a></p>  <p>&#160; SQL Azure Migration Wizard – Source Code and Binaries   <br />&#160; <a title="http://sqlazuremw.codeplex.com/" href="http://sqlazuremw.codeplex.com/">http://sqlazuremw.codeplex.com/</a></p>  <p>Good times!</p>  <p>A couple of days ago, <a href="http://blog.ehuna.org/2009/08/cleaning_up_scripts_for_sql_az.html" target="_blank">I published my notes</a> on what steps need to be taken to clean up a SQL script generated on an on-premise SQL Server 2008 so it can run on SQL Azure.</p>  <p>As I started creating a real schema with primary keys, indexes, foreign keys, Stored Procedures, etc…&#160; I realized it was a pain to manually have to clean up these scripts each time I wanted to update my SQL Azure database.</p>  <p>I thought of a few solutions and decided to go with a fast and easy way to clean up the SQL scripts using Windows PowerShell.&#160; Here’s the content of my <strong>CleanUpScriptForSQLAzure.ps1</strong> script:</p>  <pre class="csharpcode"><span class="kwrd">function</span> Replace-<span class="kwrd">String</span>($find, $replace, $path) 
{ 
    echo <span class="str">&quot;Replacing string `&quot;</span>$find`<span class="str">&quot; with string `&quot;</span>$replace`<span class="str">&quot; in file contents and file names of path: $path&quot;</span> 
    ls $path | <span class="kwrd">select</span>-<span class="kwrd">string</span> $find -list |% { echo <span class="str">&quot;Processing contents of $($_.Path)&quot;</span>; (<span class="kwrd">get</span>-content $_.Path) |% { $_ -replace $find, $replace } | <span class="kwrd">set</span>-content $_.Path -Force } 
    ls $path\*$find* |% { echo <span class="str">&quot;Renaming $($_.FullName) to $($_.FullName.Replace($find, $replace))&quot;</span>;mv $_.FullName $_.FullName.Replace($find, $replace) } 
} 

# After generating a script <span class="kwrd">with</span> SSMS we need <span class="kwrd">to</span> clean it up before running it <span class="kwrd">on</span> SQL Azure 
Replace-<span class="kwrd">String</span> <span class="str">&quot;SET ANSI_NULLS ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;SET ANSI_NULLS OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;SET ANSI_PADDING ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;SET ANSI_PADDING OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;ON \[PRIMARY\]&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;\(PAD_INDEX  = OFF,&quot;</span> <span class="str">&quot;(&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;,PAD_INDEX  = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;, PAD_INDEX  = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;PAD_INDEX  = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;,SORT_IN_TEMPDB = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;, SORT_IN_TEMPDB = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;SORT_IN_TEMPDB = OFF&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;,ALLOW_ROW_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;, ALLOW_ROW_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;ALLOW_ROW_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;,ALLOW_PAGE_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span> 
Replace-<span class="kwrd">String</span> <span class="str">&quot;, ALLOW_PAGE_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span>
Replace-<span class="kwrd">String</span> <span class="str">&quot;ALLOW_PAGE_LOCKS  = ON&quot;</span> <span class="str">&quot;&quot;</span> <span class="str">&quot;c:\data\sqlazurescripts&quot;</span></pre>
<style type="text/css">





.csharpcode, .csharpcode pre
{
	font-size: xx-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; }</style>

<p>To use the above script, generate the SQL scripts using SQL Server Management Studio pointing to an on-premise SQL Server and save the scripts in the “c:\data\sqlazurescripts” folder (or any other folder you prefer).</p>

<p><a href="http://blog.ehuna.org/liveimages/WindowsPowerShellcommandstocleanupscript_D545/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/WindowsPowerShellcommandstocleanupscript_D545/image_thumb.png" width="536" height="146" /></a> </p>

<p>Then run <strong>CleanUpScriptForSQLAzure.ps1</strong> and you should see something like this:</p>

<p><a href="http://blog.ehuna.org/liveimages/WindowsPowerShellcommandstocleanupscript_D545/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.ehuna.org/liveimages/WindowsPowerShellcommandstocleanupscript_D545/image_thumb_3.png" width="609" height="181" /></a> </p>

<p>I have found that this PowerShell script cleans up all of the scripts I’ve generated so far – including both scripts to generate schema and data, and scripts to create the stored procedures.&#160; But there are some commands not yet included in the above script (see <a href="http://blog.ehuna.org/2009/08/cleaning_up_scripts_for_sql_az.html" target="_blank">my published notes</a> for more details).</p>

<p>Until Microsoft gives us a better tool we can use these PowerShell commands to clean up the SQL scripts.&#160; You may also want to check out the <a href="http://hanssens.org/post/CTP-Release-e2809cSQL-Azure-Managere2809d-v01.aspx" target="_blank">SQL Azure Manager CTP on hanssens.org</a>.</p>

<p>Final note: if you get errors executing the <strong>CleanUpScriptForSQLAzure.ps1</strong> script in Powershell, you will need to update your execution policy.&#160; Here’s a good page with pointers on how to do that:</p>

<p>&#160; Introduction to Windows PowerShell Cmdlets 
  <br />&#160; <a title="http://computerperformance.co.uk/powershell/powershell_cmdlet.htm" href="http://computerperformance.co.uk/powershell/powershell_cmdlet.htm">http://computerperformance.co.uk/powershell/powershell_cmdlet.htm</a></p>

<p>Setting “ExecutionPolicy = RemoteSigned” in HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell worked for me.</p>]]>
      
   </content>
</entry>

</feed>
