<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>domgreen.com &#187; WCF</title>
	<atom:link href="http://domgreen.com/tag/wcf/feed/" rel="self" type="application/rss+xml" />
	<link>http://domgreen.com</link>
	<description>The geek will inherit the Earth</description>
	<lastBuildDate>Mon, 07 Jun 2010 08:42:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WCF Hot Fix &#8211; Don&#8217;t be showing your nodes</title>
		<link>http://domgreen.com/2010/01/25/wcf-hot-fix-dont-be-showing-your-nodes/</link>
		<comments>http://domgreen.com/2010/01/25/wcf-hot-fix-dont-be-showing-your-nodes/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 20:40:41 +0000</pubDate>
		<dc:creator>domgreen</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://domgreen.com/2010/01/25/wcf-hot-fix-dont-be-showing-your-nodes/</guid>
		<description><![CDATA[When browsing to a WCF endpoint hosted in an Azure web role you normally get back a web page for the service showing the location of the individual node / web role that is serving up your request (seen blurred out here) instead of the actual endpoint.
This isn&#8217;t great as you don&#8217;t want everyone knowing [...]]]></description>
			<content:encoded><![CDATA[<p>When browsing to a WCF endpoint hosted in an Azure web role you normally get back a web page for the service showing the location of the individual node / web role that is serving up your request (seen blurred out here) instead of the actual endpoint.</p>
<p>This isn&#8217;t great as you don&#8217;t want everyone knowing about your internal system and especially the URL of one of your web roles, with which they could do who know what.</p>
<p><a href="http://domgreen.com/wp-content/uploads/2010/01/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://domgreen.com/wp-content/uploads/2010/01/image_thumb4.png" width="593" height="368" /></a> </p>
</p>
<p>This can easily be fixed with this <a href="http://code.msdn.microsoft.com/KB977420" target="_blank">patch for WCF</a> that will now show the expected endpoint. This endpoint is actually the address of the load balancer that will then forward your request to an web role.</p>
<p>Once the patch is download and installed you can then simply add the following xml snippet into your behaviour for the WCF service:</p>
<p><a href="http://domgreen.com/wp-content/uploads/2010/01/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://domgreen.com/wp-content/uploads/2010/01/image_thumb5.png" width="595" height="176" /></a> </p>
<p>With this snippet added into your web.config you can browse back to the previous service and will now see that the correct URL is displayed for your service.</p>
<p><a href="http://domgreen.com/wp-content/uploads/2010/01/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://domgreen.com/wp-content/uploads/2010/01/image_thumb6.png" width="600" height="375" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://domgreen.com/2010/01/25/wcf-hot-fix-dont-be-showing-your-nodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Service management API &#8211; REST on REST</title>
		<link>http://domgreen.com/2010/01/11/service-management-api-rest-on-rest/</link>
		<comments>http://domgreen.com/2010/01/11/service-management-api-rest-on-rest/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 23:39:29 +0000</pubDate>
		<dc:creator>domgreen</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[service management API]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[WCF REST]]></category>

		<guid isPermaLink="false">http://domgreen.com/2010/01/11/service-management-api-rest-on-rest/</guid>
		<description><![CDATA[In a previous post I mentioned using the Service Management API sample library to call out to the Azure fabric from within a C# application.
The natural progression from here was to get the code working from within a web or worker role instance hosted within the cloud. Using a web role, I used the OnStart [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://domgreen.com/2010/01/06/azure-service-management-api-via-c/" target="_blank">previous post</a> I mentioned using the Service Management API <a href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=windowsazuresamples&amp;ReleaseId=3233" target="_blank">sample library</a> to call out to the Azure fabric from within a C# application.</p>
<p>The natural progression from here was to get the code working from within a web or worker role instance hosted within the cloud. Using a web role, I used the OnStart method to set up a IServiceManagent class that could then be shared with the remainder of the classes within the role.</p>
<p>When tracing the hosted services from either the OnStart method or from within default.aspx.cs I could successfully print out all of the services within my account. However, when I set up a WCF REST service to return these hosted services in an array I started to get an error with the connection to the Management API. Giving a argument error stating that a property with the name “httpRequest” is not present. This was even happening when I was using <strong>exactly</strong> the same code as I was elsewhere.</p>
<p><a href="http://domgreen.com/wp-content/uploads/2010/01/image1.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Dom Green - httpRequest" border="0" alt="Dominic Green - httpRequest" src="http://domgreen.com/wp-content/uploads/2010/01/image_thumb1.png" width="642" height="209" /></a> </p>
<p>After a push in the right direction from <a href="http://blogs.msdn.com/simondavies/default.aspx" target="_blank">Simon Davies</a> we found out&#160; that the issue was in the WCF REST service already having an OperationContext from the original REST call before calling out to the Service Management API. This <a href="http://blogs.msdn.com/pedram/archive/2008/07/19/webchannelfactory-inside-a-wcf-service.aspx" target="_blank">handy blog post</a>, help solve all my issues, all that was needed was to create a second OperationalContext before calling the management service.</p>
<pre class="brush: c-sharp" name="code">using(new OperationContextScope((IContextChannel)WebRole.serviceManagement))
{
  var hostedServices = WebRole.serviceManagement.ListHostedServices(subscriberID);

  foreach (HostedService service in hostedServices)
  {
    Trace.TraceInformation(&quot;Hosted Service: {0}&quot;, service.ServiceName);
  }
}
            </pre>
<p>Ta dar … everything now works, we can use the above code snippet to retrieve back all our hosted services by calling our own web role.</p>
]]></content:encoded>
			<wfw:commentRss>http://domgreen.com/2010/01/11/service-management-api-rest-on-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
