<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ralph Squillace -- Docs, Samples, Docs, Samples....</title><link>http://blogs.msdn.com/b/ralph.squillace/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Cross-link: Getting Started with Mobile Services Data Validation with the iOS client SDK.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2012/10/24/cross-link-getting-started-with-mobile-services-data-validation-with-the-ios-client-sdk.aspx</link><pubDate>Wed, 24 Oct 2012 22:25:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10362529</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10362529</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2012/10/24/cross-link-getting-started-with-mobile-services-data-validation-with-the-ios-client-sdk.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;A couple of cross posts here, so I don't lose them: &lt;a target="_blank" title="http://blogs.msdn.com/b/silverlining/archive/2012/10/24/data-input-validation-using-the-mobile-services-ios-client-sdk.aspx" href="http://blogs.msdn.com/b/silverlining/archive/2012/10/24/data-input-validation-using-the-mobile-services-ios-client-sdk.aspx"&gt;Data Input Validation using the Mobile Services iOS client SDK&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10362529" width="1" height="1"&gt;</description></item><item><title>On the perils of live demos.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2012/06/12/on-the-perils-of-live-demos.aspx</link><pubDate>Tue, 12 Jun 2012 16:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10318958</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10318958</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2012/06/12/on-the-perils-of-live-demos.aspx#comments</comments><description>&lt;p&gt;Which everyone probably knows, remembering that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your keyboard currently defaults to French when you reboot, and&lt;/li&gt;
&lt;li&gt;Your password will only work on the &lt;em&gt;correct URL location&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;is really always a good idea. Eh? Also, saying "Right?" when hitting Enter may actually be the way out of the conundrum, eh, Meg? (http://twitiq.com/Origameg) (Or at least it's a new game?)&lt;/p&gt;
&lt;p&gt;In any case, I did manage to show the basic functionality after a fashion -- thanks to Yavor reminding me of the correct URL. Sigh. Well, the next morning we made it all work. However... because I was busy making Win8 work on that slate with buggy video drivers, I did not know what the heck was going on **prior** to the demo work. I've just come up for air from that conference, and discovered what that song-ee thing was prior to the announcement and oh, boy. I just do not know what to say. Actually, I do. But my daughter -- &lt;em&gt;my daughter &lt;/em&gt;-- can read this blog, and I think I'll do better speaking with her directly.&lt;/p&gt;
&lt;p&gt;But... just... no. That not only isn't about development, but it's wrong, wrong, wrong. I'm not speaking as an employee, just as a human. Please, marketing people, let's learn from this, OK?&lt;/p&gt;
&lt;p&gt;Now then: Since Meg tweeted this, too: No, I didn't cancel the Friday afternoon session because of "Right" -- I thought it MUST have been funny to others, and we broke in with the correct URL and you all applauded as you should have -- no, I had a better excuse. There's someone special in my life, and I needed to be with that person. So I went. And it's all good. Plus --&amp;gt; I DID do the What's New session in the morning at 9 AM (I know you weren't there because it was entirely a male audience) and things went fine THEN. Of course, I remembered the URL. :-)&lt;/p&gt;
&lt;p&gt;And NDC is a great conference. I hope to come back next year. Meg --&amp;gt; you want me to do the high-perf messaging as a webinar? Either that, or invite me, and I'll come do it for you and your colleagues.&lt;/p&gt;
&lt;p&gt;Cheers, me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10318958" width="1" height="1"&gt;</description></item><item><title>Understanding Azure Namespaces, a bleg.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2012/01/06/understanding-azure-namespaces-a-bleg.aspx</link><pubDate>Fri, 06 Jan 2012 15:13:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10253987</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10253987</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2012/01/06/understanding-azure-namespaces-a-bleg.aspx#comments</comments><description>&lt;p&gt;I've been busy recently writing sample applications that use Windows Azure Service Bus and Windows Azure web roles and Windows Azure (damn I'm tired of typing brand names now) Access Control Service namespaces. And each time I do, I create a new namespace and often I reuse namespaces for general services in what used to be called AppFabric -- the Service Bus, Access Control, and Caching.&lt;/p&gt;
&lt;p&gt;If I'm creating a set of applications, and all I need is access control to that application, I'll need to use an ACS namespace to configure that application as a relying party (which I would call a relying or dependent application, but I don't write the names). But do I use an ACS namespace that is already in use? Do I create a new ACS namespace just for that application? Or are there categories of people or clients that I can group into an ACS namespace, trusted by one or more applications LIKE those used by those people or clients?&lt;/p&gt;
&lt;p&gt;I'm curious what you do, but I'm doing more work figuring out the best way to go here from the perspective of the real world. More soon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10253987" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Cloud/">Cloud</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/ACS/">ACS</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/namespaces/">namespaces</category></item><item><title>Windows Azure: P &amp; P Enterprise Integration Pack with failure/retry **and** fine-grained autoscaling APIs (among others)</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/12/04/windows-azure-p-amp-p-enterprise-integration-pack-with-failure-retry-and-fine-grained-autoscaling-apis-among-others.aspx</link><pubDate>Sun, 04 Dec 2011 16:56:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10244050</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10244050</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/12/04/windows-azure-p-amp-p-enterprise-integration-pack-with-failure-retry-and-fine-grained-autoscaling-apis-among-others.aspx#comments</comments><description>&lt;p&gt;This release of the &lt;a href="http://blogs.msdn.com/b/agile/archive/2011/12/02/announcing-the-enterprise-library-integration-pack-for-windows-azure-with-autoscaling-transient-fault-handling-and-more.aspx" title="Patterns &amp;amp;amp; Practices Enterprise Integration Pack" target="_blank"&gt;Patterns &amp;amp; Practices Enterprise Integration Pack&lt;/a&gt; is simply wonderful and is required for real-world Azure development. Read the announcement for the full list of features, but in particular I want to call out the autoscaling and transient failure/retry APIs offered. Azure applications can use these to handle a majority of the big needs that flexible and robust apps in the cloud need -- and still take advantage of the entire platform as designed, rather than being "trapped" in a VM.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We're soon going to release some guidance around building multi tenant applications in Windows Azure, and this integration pack is very, very important for that design approach as well. Have a look.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10244050" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Patterns/">Patterns</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Cloud/">Cloud</category></item><item><title>Free Windows Azure training with Scott Klein in San Francisco, June 13-14.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/05/30/free-windows-azure-training-with-scott-klein-in-san-francisco-june-13-14.aspx</link><pubDate>Tue, 31 May 2011 00:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10169731</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10169731</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/05/30/free-windows-azure-training-with-scott-klein-in-san-francisco-june-13-14.aspx#comments</comments><description>&lt;p&gt;Hi all. If you're in the Bay Area and want to get up to speed on Windows Azure -- whether you want to learn how to use it or whether you want to validate your own approach! -- MVP Scott Klein of Blue Syntax Software&amp;nbsp;(&lt;a target="_blank" href="http://www.bluesyntax.net/blogs.aspx" title="blog"&gt;blog&lt;/a&gt;)&amp;nbsp;(author and co-author of many books including &lt;a target="_blank" href="http://www.amazon.com/Pro-Azure-Experts-Voice-NET/dp/1430229616/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1306801008&amp;amp;sr=1-1" title="Pro Sql Azure"&gt;Pro SQL Azure&lt;/a&gt;) is offering a free two-day hands-on training course in all of Windows Azure in downtown San Francisco on June 13-14 (&lt;a target="_blank" href="http://www.azurebootcamp.com/city/SanFrancisco" title="registration and information here"&gt;registration and information here&lt;/a&gt;). I'll also be presenting and discussing the forthcoming release of the &lt;a target="_blank" href="http://blogs.msdn.com/b/appfabric/archive/2011/05/15/announcing-the-windows-azure-appfabric-ctp-may-and-june-releases.aspx" title="Windows Azure AppFabric June CTP"&gt;Windows Azure AppFabric June CTP&lt;/a&gt; including the AppFabric Development Platform and show you how to get your distributed cloud-based applications up and running quickly. In addition, my colleague Brian Swan will also be there to discuss using &lt;a target="_blank" href="http://blogs.msdn.com/b/brian_swan/archive/2011/05/26/new-version-of-windows-azure-sdk-for-php-v-3-0-available.aspx" title="PHP"&gt;PHP&lt;/a&gt; and &lt;a target="_blank" href="http://blogs.msdn.com/b/brian_swan/archive/2011/05/24/consuming-odata-via-jsp-in-windows-azure.aspx" title="Odata and Java"&gt;Odata and Java&lt;/a&gt; in Windows Azure.&lt;/p&gt;
&lt;p&gt;Scott has tons of experience to help you understand Azure, its services, and get you started building applications over two days -- few could be better to learn from. I am really looking forward to it. If you're in the area and interested, please come. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10169731" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Azure+AppFabric+Cloud/">Azure AppFabric Cloud</category></item><item><title>Technical Note: Proxy Classes Different when using Svcutil.exe and VS Add Service Reference (doubleclick.com edition)</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/27/technical-note-proxy-classes-different-when-using-svcutil-exe-and-vs-add-service-reference-doubleclick-com-edition.aspx</link><pubDate>Fri, 28 Jan 2011 04:28:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10121327</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10121327</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/27/technical-note-proxy-classes-different-when-using-svcutil-exe-and-vs-add-service-reference-doubleclick-com-edition.aspx#comments</comments><description>&lt;p&gt;The WSDL url &lt;span style="FONT-FAMILY: 'Segoe UI','sans-serif'; COLOR: #333333; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a target="_blank" href="http://advertisersapi.doubleclick.net/v1.12/api/dfa-api/campaign?wsdl"&gt;http://advertisersapi.doubleclick.net/v1.12/api/dfa-api/campaign?wsdl&lt;/a&gt;&amp;nbsp;was used by a customer with the Svcutil.exe tool to generate a proxy class and associated message and data classes, and it worked fine. But when they tried to use the Add Service Reference... (often shortened to "ASR")&amp;nbsp;wizard in Visual Studio, they had a problem: they could not import the fault contracts. In fact, even with Svcutil.exe, there was a warning generated due to the tool's inability to understand the WSDL:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: 'Segoe UI','sans-serif'; COLOR: #333333; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt; padding-left: 30px;"&gt;&lt;span style="color: #1f497d; font-size: 9pt;"&gt;&lt;span style="font-family: Calibri;"&gt;Warning: Fault named &lt;span class="spelle"&gt;ApiException&lt;/span&gt; in operation &lt;span class="spelle"&gt;copyCampaigns&lt;/span&gt; cannot be imported.&lt;br /&gt;&amp;nbsp;Unsupported WSDL, the fault message part must reference an element. This fault&lt;br /&gt;&lt;span class="grame"&gt;message&lt;/span&gt; does not reference an element. If you have edit access to the WSDL &lt;span class="spelle"&gt;docum&lt;/span&gt;&lt;br /&gt;&lt;span class="grame"&gt;ent&lt;/span&gt;, you can fix the problem by referencing a schema element using the 'element'&lt;br /&gt;&amp;nbsp;&lt;span class="grame"&gt;attribute&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In any case, the difference between ASR and Svcutil.exe is that one has the &lt;strong&gt;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/aa347733.aspx" title="&amp;lt;strong&amp;gt;UseSerializerForFaults&amp;lt;/strong&amp;gt;"&gt;UseSerializerForFaults&lt;/a&gt;&lt;/strong&gt; option easily available to you as a switch on the command line. Using this switch instructs Svcutil.exe to use the XmlSerializer to handle faults instead of the default, which is the DataContractSerializer. In this case, although Svcutil.exe has indicated that the WSDL for the fault is flawed, it continues to import the service operation. If you want to enable VS ASR to do the same thing:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Show All Files&lt;/strong&gt; in the Solution Explorer.&lt;/li&gt;
&lt;li&gt;Open the &lt;strong&gt;Reference.svcmap&lt;/strong&gt; file in your service reference.&lt;/li&gt;
&lt;li&gt;Set the option &amp;lt;UseSerializerForFaults&amp;gt; to false in Reference.svcmap and save it. (NOTE: Take care NOT to update the service reference, as doing so resets the option to true.)&lt;/li&gt;
&lt;li&gt;Open the reference.cs and you should see the operations generated.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;The WSDL for the fault contract will still need to be modified before the tools can generate the fault contract propery, but at least you can get your service proxies generated. Hope this helps. It's part of a larger series of issues revolving around this area. For one view, see &lt;a target="_blank" href="http://dotnetbutchering.blogspot.com/2010/03/add-service-reference-duplicates.html" title="Add Service Reference duplicates properties on Faults "&gt;http://dotnetbutchering.blogspot.com/2010/03/add-service-reference-duplicates.html&lt;/a&gt;, which points out a &lt;a target="_blank" href="http://connect.microsoft.com/wcf/feedback/details/424733/svcutil-generates-faults-elements-always-with-datacontract-serializer" title="bug"&gt;bug&lt;/a&gt; that **may** have been fixed in a more recent version of the .NET Framework -- or may not. I'll try to find out tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10121327" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Add+Service+Reference/">Add Service Reference</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/ASR/">ASR</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Svcutil-exe/">Svcutil.exe</category></item><item><title>Technical Note: Reference to excellent Windows Phone 7 crypto discussion.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/24/technical-note-reference-to-excellent-windows-phone-7-crypto-discussion.aspx</link><pubDate>Mon, 24 Jan 2011 18:23:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10119532</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10119532</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/24/technical-note-reference-to-excellent-windows-phone-7-crypto-discussion.aspx#comments</comments><description>&lt;p&gt;Ian Miers has posted the code for doing "good" crypto for static data storage on the phone, but more importantly written about it, &lt;a href="http://encryptedzoology.blogspot.com/2011/01/usability-and-cryptography.html" title="here"&gt;here&lt;/a&gt;. Understanding this code, the problems it poses, and the processes it implements is important to doing things with &lt;a href="http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/20/technical-note-windows-phone-7-basic-authentication-over-https.aspx" title="secure web services"&gt;secure web services&lt;/a&gt;. More later. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10119532" width="1" height="1"&gt;</description></item><item><title>How Do I.... Linq directly into an ItemCollection?</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/21/how-do-i-linq-directly-into-an-itemcollection.aspx</link><pubDate>Sat, 22 Jan 2011 05:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10118939</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10118939</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/21/how-do-i-linq-directly-into-an-itemcollection.aspx#comments</comments><description>&lt;p&gt;I have this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial;"&gt;private void LoadSupportSolutionsSection(ItemCollection itemCollection, XElement category)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Solution, url att, Title, Description.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var solutions = from sol in category.Elements("Solution")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select new TreeViewItem {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Header = sol.Element("Title").Value,&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tag = sol.Attribute("url").Value,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ToolTip = new ToolTip() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Content=sol.Element("Description").Value, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StaysOpen=true&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (TreeViewItem item in solutions)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; itemCollection.Add(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;A very simple linq query spun from from XML returned from&amp;nbsp;a Web service. The TreeViewItem is a WPF tree view item. So how do I write the select portion such that it inserts &lt;em&gt;into the TreeView.Items collection each newly created TreeViewItem?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Anyone have an idea? I have two or three creative ones, but I have tried them out yet. Any suggestions appreciated....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10118939" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/XML/">XML</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Web+Service/">Web Service</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Linq/">Linq</category></item><item><title>Technical Note: Windows Phone 7: Basic Authentication over HTTPS. </title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/20/technical-note-windows-phone-7-basic-authentication-over-https.aspx</link><pubDate>Fri, 21 Jan 2011 00:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10118453</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10118453</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/20/technical-note-windows-phone-7-basic-authentication-over-https.aspx#comments</comments><description>&lt;p&gt;A note directly related to the larger blog project started with the last post, &lt;a target="_blank" href="http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/03/cloud-data-a-newbie-series-the-issues.aspx" title="Cloud Data: A Newbie Series --The issues."&gt;http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/03/cloud-data-a-newbie-series-the-issues.aspx&lt;/a&gt;. While I have been working on a lot of phone applications, almost all of the work around the net using HTTP web requests involves Web services -- REST or SOAP style -- that do not require much if anything in the way of authentication and security. Yet when a service provides data of reasonable value, that's what you need. Currently the Windows Phone 7 supports only HTTPS to secure communications, but since that's what is used by the bulk of the Internet selling music, books, tickets, and so on, it is more than sufficient for the vast majority of consumer applications. This post is to demonstrate how to make those calls on the Windows Phone 7 using Basic Authentication over HTTPS using several different mechanisms. Each of these works against an HTTPS endpoint at the Windows Azure DataMarket to access free data sources, such as the United States crime statistics from 2008. &lt;/p&gt;
&lt;p&gt;&lt;span style="color: #3366ff;"&gt;&lt;strong&gt;ASIDE:&lt;/strong&gt;&lt;/span&gt; Some people have noticed that the &lt;a href="http://cisforcoder.wordpress.com/2010/12/01/how-to-implement-basic-http-authentication-in-wcf-on-windows-phone-7/"&gt;WCF implementation on the phone does not support "easy" Basic authentication of HTTP&lt;/a&gt;. No, it doesn't. But that's by design to protect you from "accidentally" using passwords in the clear over the network. Perhaps that's too much "protecting you", but it is documented &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.security.usernamepasswordclientcredential(VS.95).aspx" title="here"&gt;here&lt;/a&gt;, in the note in the topic. If you don't use HTTPS -- that is, if you use HTTP -- the Client.Credentials property is ignored by design.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000;"&gt;&lt;strong&gt;SECURITY NOTE:&lt;/strong&gt;&lt;/span&gt; Because whenever sample code does not mention this, there's always some people in a big hurry that you have to remind: Obtain the username/password in a secure fashion. The most reasonably secure fashion is to prompt for it so that the user can enter it in a PasswordBox. However, there are other ways to encrypt in a strong way the strorage of such data on the phone. More in the future about several ways, but one is described here by Rob Tiffany: &lt;a href="http://robtiffany.com/windows-phone-7/dont-forget-to-encrypt-your-windows-phone-7-data" title="http://robtiffany.com/windows-phone-7/dont-forget-to-encrypt-your-windows-phone-7-data"&gt;Don&amp;rsquo;t forget to Encrypt your Windows Phone 7 Data&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: medium;"&gt;Using the WebClient Class (&lt;span style="font-size: small;"&gt;a good example with slightly different style found &lt;/span&gt;&lt;a target="_blank" href="http://blog.toetapz.com/2010/11/15/windows-phone-7-and-making-https-rest-api-calls-with-basic-authentication/" title="here"&gt;&lt;span style="font-size: small;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;!&lt;/span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Using System.Net;&lt;/p&gt;
&lt;p&gt;WebClient client = new WebClient();&lt;/p&gt;
&lt;p&gt;// Handle the response when it comes.&lt;br /&gt;client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);&lt;/p&gt;
&lt;p&gt;// Your password; some services will call this a key, or a secret, or something. &lt;br /&gt;string accountkeyOrPassword = "&amp;lt;account or key or password goes here&amp;gt;";&lt;/p&gt;
&lt;p&gt;// Add the username/accountkeyOrPassword to the Client.Credentials property by creating a new NetworkCredential&lt;br /&gt;client.Credentials = new NetworkCredential("accountKey", accountkeyOrPassword);&lt;/p&gt;
&lt;p&gt;// Handle the response&lt;br /&gt;client.DownloadStringAsync(new Uri("&lt;a href="https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime?$filter=City%20eq%20%27Seattle%27&amp;amp;$top=100"&gt;https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime?$filter=City%20eq%20%27Seattle%27&amp;amp;$top=100&lt;/a&gt;"));&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: medium;"&gt;Using the HttpWebRequest Class&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: medium;"&gt;&lt;span style="font-size: small;"&gt;HttpWebRequest client&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; = WebRequest.CreateHttp(&lt;br /&gt;&amp;nbsp;new Uri("&lt;/span&gt;&lt;a href="https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime?$filter=City%20eq%20%27Seattle%27&amp;amp;$top=100"&gt;&lt;span style="font-size: small;"&gt;https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/CityCrime?$filter=City%20eq%20%27Seattle%27&amp;amp;$top=100&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as HttpWebRequest;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;// Your password; some services will call this a key, or a secret, or something. &lt;br /&gt;string accountkeyOrPassword = "&amp;lt;account or key or password goes here&amp;gt;";&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;// Add the username/accountkeyOrPassword to the Client.Credentials property by creating a new NetworkCredential&lt;br /&gt;client.Credentials = new NetworkCredential("accountKey", accountkeyOrPassword);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;// To support Windows Azure DataMarket&lt;br /&gt;client.AllowReadStreamBuffering = true;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;// Call and handle the response.&lt;br /&gt;client.BeginGetResponse(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (asResult) =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispatcher.BeginInvoke(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; () =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var response = client.EndGetResponse(asResult);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; responseString = reader.ReadToEnd();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException failure)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw failure;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; null&lt;br /&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;In a next post, I'll show how to use several different&amp;nbsp;optimized client libraries to do this work. &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10118453" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/DataMarket/">DataMarket</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/HttpWebRequest/">HttpWebRequest</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/HTTPS/">HTTPS</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Basic+Auth/">Basic Auth</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Windows+Phone+7/">Windows Phone 7</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WebClient/">WebClient</category></item><item><title>Cloud Data: A Newbie Series --The issues.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/03/cloud-data-a-newbie-series-the-issues.aspx</link><pubDate>Mon, 03 Jan 2011 20:09:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10111238</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=10111238</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2011/01/03/cloud-data-a-newbie-series-the-issues.aspx#comments</comments><description>&lt;p&gt;It's been an interesting couple of years for me -- I've been assigned to two different projects that have failed to find their way to RTM as originally conceived -- which cut my blog writing down a bit. It happens; I've been working most recently on some internal tools and demos designed to make use of the Microsoft cloud services and client technologies we have to make data accessible on any platform, always (or almost-always) available, reasonably efficient, and secure to the level that the value of the data requires.&lt;/p&gt;
&lt;p&gt;Of course, that's the market-speak way of putting it; in point of fact, I wanted to build an application that makes use of private data, shares the appropriate amount publicly, and can be used from anywhere so that customers -- including me -- could use it the way that they wanted. This is a dumb, very normal idea -- get some data and build an app that actually uses it in a helpful way. &lt;/p&gt;
&lt;p&gt;I'm actually trying to build two applications, but one is a tad behind schedule so I'll wait on that one. In any case, the first one required cutting the teeth a bit on a series of application technologies, assembled as loosely built cloud components using the following technologies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft SQL Server 2008 and Express Edition with Advanced Services&lt;/li&gt;
&lt;li&gt;Microsoft&amp;nbsp;Linq2SQL -- a data access technology which is not our most supported technology, so far as I can see&lt;/li&gt;
&lt;li&gt;Microsoft Entity Framework (EF) &lt;/li&gt;
&lt;li&gt;SQL Azure&lt;/li&gt;
&lt;li&gt;Windows Azure&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.linqpad.net/"&gt;http://www.linqpad.net/&lt;/a&gt;&amp;nbsp;-- a wonderful application for working with data in the cloud or locally&lt;/li&gt;
&lt;li&gt;Visual Studio 2010&lt;/li&gt;
&lt;li&gt;WPF&lt;/li&gt;
&lt;li&gt;Windows Phone 7 with Silverlight&lt;/li&gt;
&lt;li&gt;OData&lt;/li&gt;
&lt;li&gt;WCF&lt;/li&gt;
&lt;li&gt;WCF Data Services&lt;/li&gt;
&lt;li&gt;Windows Azure DataMarket&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've touched each one of these items in order to create a working set of applications that can view, query, print, or send Microsoft technical and developer documentation topics based on internal metadata that is not used by search engines such as Google or Bing because they do not have access to it. The goal of this system, ultimately, is to enable any customer to find Microsoft information much faster than the global search engines can -- that is, you won't google or bing your question because you'll be able to locate the precise information you want based on query information the global services do not have. &lt;/p&gt;
&lt;p&gt;Another way of saying this is that the applications aim to do one thing: unblock your work faster than any other current way within a specific problem domain. This isn't a global effort; I'm trying to keep the domain scope limited to data-centric .NET development with SQL Server 2008. But if your work touches this area, the idea is that the apps should be able to beat every other mechanism of finding your answer. If I can do that within a small domain, we can see where we can take that in larger problem spaces. &lt;/p&gt;
&lt;p&gt;This is my gig; but along the way, I've touched so many different technologies that what I hope will end up being of help is the code that shows how to work with different technologies together -- you might not care for my specific effort. You have your own. :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10111238" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/SQL+Server+2008/">SQL Server 2008</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/EF/">EF</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/DataMarket/">DataMarket</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Odata/">Odata</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WCF+Data+Services/">WCF Data Services</category></item><item><title>Boundaryless WCF and REST service communication -- The Windows Azure platform AppFabric Service Bus (with Access Control!)</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2009/12/29/boundaryless-wcf-and-rest-service-communcation-the-windows-azure-platform-appfabric-service-bus-with-access-control.aspx</link><pubDate>Tue, 29 Dec 2009 20:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942053</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=9942053</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2009/12/29/boundaryless-wcf-and-rest-service-communcation-the-windows-azure-platform-appfabric-service-bus-with-access-control.aspx#comments</comments><description>&lt;P&gt;This past month I've been doing some work on the &lt;A title="AppFabric Service Bus" href="http://msdn.microsoft.com/en-us/library/ee732537.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ee732537.aspx"&gt;AppFabric Service Bus&lt;/A&gt;. It's hard to get a grip on the "feature" associated with this technology&amp;nbsp;at first glance, but I'll take my first shot right here: "The Windows Azure platform Service Bus enables you to build Web services and clients that can traverse boundaries like firewalls and NAT routers without making any direct modifications to those boundaries themselves. What does this give you? Nothing short of the ability to glue applications together and stretch them around the world --anywhere the data or applications reside, or to any platforms (smart phones, anyone? Dishwashers? Toasters?) on which the callers reside. In short, it is the glue that makes secure Software plus Services not only a reality, but a reality that you can begin building today."&lt;/P&gt;
&lt;P&gt;OK, that's a little overheated (geez: "a reality that you can begin building today?" ouch!! :-), but technically it is very close to what's going on here. You must realize that a production-quality scenario involves&amp;nbsp;a lot of additional work -- but the genius-cool of this bit of tech is that you do NOT have to build the secure glue system between data chunks and applications -- just build your WCF service that exposes the data or application behavior, and instead of configuring it for local behavior, you configure it to use one of the relay bindings that come with the Service Bus, and to use tokens from the Access Service to authenticate and authorize when communicating with the Service Bus.&lt;/P&gt;
&lt;P&gt;Somewhere in the cloud waits the Service Bus (and Access Control service). When you start your local WCF service, the configured relay bindings will communicate with the Service Bus in the cloud (if permission is granted), and then analyze the network between the two endpoints, establishing a bidirectional stream through any firewalls and NAT systems. Clients anywhere, on any Web-enabled platform, can then (if they have permission from the Access Control service), connect to the Service Bus &lt;EM&gt;as though it is the original service. &lt;/EM&gt;The endpoint addresses that the client use -- Service Bus namespaces and names -- are protocol and location independent. Although you can secure the endpoint address information, the name itself has meaning only to the Service Bus -- and to nothing else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;What kind of tokens can you use to be authenticated and authorized? The easiest way is to use Simple Web Tokens, for which the Access Control service is a trusted provider to the Service Bus. Because the Access Control service is extensible, however, you can build a security system that uses the Access Control service to authenticate and authorize Service Bus access without changing the original WCF service or the Service Bus configuration at all. (And, as the Access Control service supports AD FS integration -- SAML tokens -- you can do very robust and integrated security.) &lt;/P&gt;
&lt;P&gt;The ability to communicate across firewall and NAT boundaries without management involvement AND the ability to do this securely across platforms -- both of these features are needed to make it possible for you to build the cloud/desktop/server/gadget applications that you can envision for your customers ease and your productivity. This is simply way, way cool. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;I'll do some examples very soon.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9942053" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/Service+Bus/">Service Bus</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/AppFabric/">AppFabric</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/WCF/">WCF</category></item><item><title>The Microsoft &amp;quot;Oslo&amp;quot; Base Domain Library (the BDL) -- now not completely in T-SQL!</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/11/the-microsoft-base-domain-library-the-bdl.aspx</link><pubDate>Fri, 12 Jun 2009 06:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9729281</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=9729281</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/11/the-microsoft-base-domain-library-the-bdl.aspx#comments</comments><description>&lt;P&gt;The Microsoft "Oslo" repository "&lt;A class="" title='"Oslo" repository' href="http://msdn.microsoft.com/en-us/library/dd129586(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd129586(VS.85).aspx"&gt;provides a robust, enterprise-hardened storage location for the data models. It takes advantage of the best features of SQL Server 2008 to deliver on critical areas such as scalability, security, and performance&lt;/A&gt;." The repository team took SQL Server 2008, and used SQL Server best practices to create a series of internal schemas that enabled extremely important features of any enterprise-scale database application -- particularly manageability and security, but also scalability and performance. In short, it's a "pre-designed" SQL Server 2008 application that you can use to kick-start enterprise database application design, development, and deployment. All well and good. If you're strong in SQL skills, you can go to the link in the first sentence of this graph and read all about how it works and the features it supports.&lt;/P&gt;
&lt;P&gt;Although the "Oslo" repository can be used for any kind of data-driven application (because it's just SQL Server 2008, duh), it is especially functional when used with data structures that fit the basic schemas in the "Oslo" repository.&amp;nbsp;However, while you can design your data structures in T-SQL to take advantage of the repository features using the documentation &lt;A class="" title='"Oslo" Repository Schemas' href="http://msdn.microsoft.com/en-us/library/dd857586(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857586(VS.85).aspx"&gt;here&lt;/A&gt;, the question is: How do you do this in "M"?&lt;/P&gt;
&lt;P&gt;If you're already familiar with "M" and "Oslo" a little bit, you might know that you can obtain all the features of the repository Base Domain Library (BDL) by compiling your "M" domains with the &lt;STRONG&gt;/t:Repository&lt;/STRONG&gt; switch. What this does -- among other things -- is create matching SQL Server views for your tables (using the same name as the tables but without the "Table" on the end), associating your domain models with the appropriate repository &lt;A class="" title='"Oslo" repository Folders' href="http://msdn.microsoft.com/en-us/library/dd894380(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd894380(VS.85).aspx"&gt;Folders&lt;/A&gt;, and creating triggers that can be used to secure data access in any way SQL Server 2008 supports, among other things (you can read more about this &lt;A class="" href="http://msdn.microsoft.com/en-us/library/dd861761(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd861761(VS.85).aspx"&gt;here&lt;/A&gt;). This switch, I think, is a tremendous boon to developers who either don't want to focus on doing data modeling work in T-SQL (we are hoping "M" will be much more efficient and pleasant to use) or who are not especially familiar with T-SQL and SQL Server 2008. Almost all our current samples (&lt;A class="" href="http://msdn.microsoft.com/en-us/library/dd857483(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857483(VS.85).aspx"&gt;How to: Populate a Model into the "Oslo" Repository&lt;/A&gt;, &lt;A class="" title='How to: Create data using "M"' href="http://msdn.microsoft.com/en-us/library/dd861712(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd861712(VS.85).aspx"&gt;How to: Create data using "M"&lt;/A&gt;, &lt;A class="" href="http://msdn.microsoft.com/en-us/library/dd861719(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd861719(VS.85).aspx"&gt;How to: Install the HumanResources Sample Model using "M"&lt;/A&gt;, and &lt;A class="" title="creating custom icons and display names" href="http://msdn.microsoft.com/en-us/library/dd857519(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857519(VS.85).aspx"&gt;How to: Use "M" to Create Custom Icons and Display Names&lt;/A&gt;&amp;nbsp;for some examples) use the &lt;STRONG&gt;/t:Repository&lt;/STRONG&gt; switch to turn on "Oslo" repository feature patterns. It works, and it's easy.&lt;/P&gt;
&lt;P&gt;There is a problem with this switch for people who want to use "M" but who understand database design well enough to want to control the projection of "M" into T-SQL and into the "Oslo" repository: it's all or nothing. If you create 100 extents in "M" you'll get (most likely) 100+ tables -- it varies depending on the particular "M" statements -- and if you use the /t:Repository target switch you'll ALSO get 100+ views, all secured by their own insert triggers. However, it is often the case that the database schemas contain many more tables than views. Using views are, after all, a very good way to expose data to client applications in a way that is more efficient and understandable for them.&amp;nbsp;Most client applications do not need to know all the internal storage details, and those developers may well not want to know themselves. (In addition, with views you have the ability to version the underlying data tables and modify the views to draw the data from the new tables so that client applications consuming views can continue functioning. Views are good.) No, instead of having everything done for you at all times, you'd often prefer to be able to specify which views are created yourself, and specify which of the "Oslo" repository features are to be applied to them. Right?&lt;/P&gt;
&lt;P&gt;The May CTP release of "Oslo" is the beginning of your ability to do this repository "feature pattern" work in "M" and the &lt;A class="" title='"M" toolchain' href="http://msdn.microsoft.com/en-us/library/dd129517(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd129517(VS.85).aspx"&gt;"M" toolchain&lt;/A&gt; rather than having to do this work in T-SQL directly. To do so in the May CTP release, you must use the various "M"-based patterns to structure your data correctly and then add some specific T-SQL calls in the &lt;STRONG&gt;-postSQL&lt;/STRONG&gt; parameter of M.exe -- and you do not specify /t:Repository in the m.exe command. The only trick is that there are a couple different ways to handle your "Oslo" repository Folder creation. The easiest way I have found and for which I wrote an example is to:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use the &lt;STRONG&gt;HasFolderAndAutoId&lt;/STRONG&gt; type in the &lt;STRONG&gt;System&lt;/STRONG&gt; module, which creates the Folder and Id patterns needed to enable "Oslo" repository management and security features and expose them in "Quadrant".&lt;/LI&gt;
&lt;LI&gt;Make sure your table ends in "Table". :-) (The answer to your question is given to you if you examine the &lt;A class="" title=AddForeignFolderKey href="http://msdn.microsoft.com/en-us/library/dd857550(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857550(VS.85).aspx"&gt;AddForeignFolderKey&lt;/A&gt; procedure. For the complete list of pattern restrictions that may be necessary to take advantage of all repository features, see &lt;A class="" title=AddStandardPatterns href="http://msdn.microsoft.com/en-us/library/dd819161(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd819161(VS.85).aspx"&gt;Using the AddStandardPatterns Procedure&lt;/A&gt;.)&lt;/LI&gt;
&lt;LI&gt;Use the &lt;STRONG&gt;PathsFolder()&lt;/STRONG&gt; pattern when you declare the values for your extent.&lt;/LI&gt;
&lt;LI&gt;Create your own view that has the same name as the table in step 2 but without the "Table" at the end.&lt;/LI&gt;
&lt;LI&gt;Use the &lt;STRONG&gt;mx.exe createFolder&lt;/STRONG&gt; option to create the Folder name in the repository that you specified in your extent value declarations.&lt;/LI&gt;
&lt;LI&gt;Create a .sql file that calls &lt;STRONG&gt;AddForeignFolderKey&lt;/STRONG&gt; passing the module name and the view name.&lt;/LI&gt;
&lt;LI&gt;Compile your .m file to an image, using the -postSql parameter to add the .sql file to the image. &lt;/LI&gt;
&lt;LI&gt;Install the image into the repository using mx.exe. If you are doing iterative work, also pass the -f switch, which will delete and reinstall the module if it is the same. &lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;If you want to see the sample that does this, scroll to the bottom of &lt;A class="" title="Folders and Ids" href="http://msdn.microsoft.com/en-us/library/dd894380(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd894380(VS.85).aspx"&gt;Folders and Ids&lt;/A&gt;, which will continue to be updated and corrected on a regular basis as we update that information. If you want to read about how all of this works in T-SQL, see &lt;A class="" title='"Oslo" Repository Schemas' href="http://msdn.microsoft.com/en-us/library/dd857586(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857586(VS.85).aspx"&gt;"Oslo" Repository Schemas&lt;/A&gt; documentation that my colleague Jason Roth put together for the January CTP release.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9729281" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/oslo/">oslo</category></item><item><title>"Oslo" -- SQL Server 2008 includes Express.... Just FYI</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/08/oslo-sql-server-2008-includes-express-just-fyi.aspx</link><pubDate>Mon, 08 Jun 2009 20:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9708610</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=9708610</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/08/oslo-sql-server-2008-includes-express-just-fyi.aspx#comments</comments><description>It has occurred in the forum (&lt;A class="" href="http://social.msdn.microsoft.com/Forums/en-US/oslo/threads" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/oslo/threads"&gt;http://social.msdn.microsoft.com/Forums/en-US/oslo/threads&lt;/A&gt;) that people sometimes don't have access to SQL Server 2008 -- or &lt;A class="" href="http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/5fdbc6dc-f738-452a-94a6-84fd9fa9d26d" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/5fdbc6dc-f738-452a-94a6-84fd9fa9d26d"&gt;they don't think they do&lt;/A&gt;. In point of fact, however, you can use SQL Server 2008 Express editions to satisfy the requirement. Get that &lt;A class="" href="http://www.microsoft.com/express/sql/download/" target=_blank mce_href="http://www.microsoft.com/express/sql/download/"&gt;here&lt;/A&gt;. &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9708610" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/oslo/">oslo</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/repository/">repository</category></item><item><title>OK, this is dumb, but this Bing thing is really great.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/03/ok-this-is-dumb-but-this-bing-thing-is-really-great.aspx</link><pubDate>Wed, 03 Jun 2009 20:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9691926</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=9691926</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2009/06/03/ok-this-is-dumb-but-this-bing-thing-is-really-great.aspx#comments</comments><description>&lt;P&gt;Strangely enough, although I love the company I work for, I'm not interested in technologies that we put out that aren't really the best. Often, we end up making them the best through iterations, and that's wonderful. Sometimes we don't, and we have great competition in the world, and that benefits us and everyone. Anyway, I don't typically deal with too much hype, but it is **really** exciting to use bing.com as a search and discover that it works great. I mean, really great. By far the best results for the work and personal things I do than the competitor that I typically use. I'm very happy about this; it's a hard field to make progress in, and we've finally begun to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;At least, at first glance. It'll be interesting to me to see whether it can keep up the good work as I start to use it more heavily.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9691926" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/search/">search</category><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/bing/">bing</category></item><item><title>Microsoft code name "Oslo" -- New Tutorials for the May CTP</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2009/05/27/microsoft-code-name-oslo-new-tutorials-for-the-may-ctp.aspx</link><pubDate>Wed, 27 May 2009 18:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9644565</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=9644565</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2009/05/27/microsoft-code-name-oslo-new-tutorials-for-the-may-ctp.aspx#comments</comments><description>&lt;P&gt;I've spent quite a bit of the past two years working on &lt;A class="" title='"Oslo"' href="http://msdn.microsoft.com/en-us/oslo/default.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/oslo/default.aspx"&gt;"Oslo"&lt;/A&gt; and find it an amazing challenge to explain to people who aren't database gurus. Have a look -- it's an amazing set of tools to begin developing .NET applications with modeling techniques that don't make much sense if you haven't been interested in data modeling or advanced reusable libraries and so on. One thing we've done on the &lt;A class="" title='"Oslo" documentation' href="http://msdn.microsoft.com/en-us/library/dd129514.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd129514.aspx"&gt;"Oslo" documentation&lt;/A&gt; team is to put together two main tutorials that you should know about, but which might be hard to find.&lt;/P&gt;
&lt;P&gt;First, the &lt;A class="" title="Getting Started" href="http://msdn.microsoft.com/en-us/library/dd857488(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd857488(VS.85).aspx"&gt;Getting&amp;nbsp;Started with "Oslo"&lt;/A&gt;&amp;nbsp;tutorial walks you through a relatively simple -- but very real -- modeled application from start to finish. &lt;/P&gt;
&lt;P&gt;Second, we didn't want anyone getting stalled out working with&amp;nbsp;"Oslo" simply because we didn't give examples using your favorite data access technique.&amp;nbsp;So we put&amp;nbsp;together examples of four data access technologies that all access the&amp;nbsp;model data inside SQL Server 2008. &lt;A class="" title="Loading Models with Data" href="http://msdn.microsoft.com/en-us/library/dd861723(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd861723(VS.85).aspx"&gt;They are here&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope they help, and we'll be adding more documentation soon. Feel free to bother me here or make any request in the &lt;A class="" title=forums href="http://social.msdn.microsoft.com/Forums/en-US/oslo/threads" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/oslo/threads"&gt;forum&lt;/A&gt;.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9644565" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/ralph.squillace/archive/tags/oslo/">oslo</category></item><item><title>Patterns &amp; Practices: Extremely useful WCF Security Guidance Project How To topics available.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2008/04/08/patterns-practices-extremely-useful-wcf-security-guidance-project-how-to-topics-available.aspx</link><pubDate>Wed, 09 Apr 2008 08:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8371177</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=8371177</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2008/04/08/patterns-practices-extremely-useful-wcf-security-guidance-project-how-to-topics-available.aspx#comments</comments><description>&lt;P&gt;I was recently asked to have a look at some really nice How To topics on WCF security that the Patterns &amp;amp; Practices people have worked up, and am quite happy with them; so much so I wanna tell them to let us fold them back into the regular SDK documentation! The project's Web site is &lt;A href="http://www.codeplex.com/WCFSecurity"&gt;http://www.codeplex.com/WCFSecurity&lt;/A&gt;, but to have a quick list of the topics I had a chance to see (plus some nice walkthrough videos), check out J.D. Meier's blog entry on them at &lt;A href="http://blogs.msdn.com/jmeier/archive/2008/03/27/patterns-and-practices-wcf-security-guidance-now-available.aspx"&gt;http://blogs.msdn.com/jmeier/archive/2008/03/27/patterns-and-practices-wcf-security-guidance-now-available.aspx&lt;/A&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Note: There are two very useful WCF security projects going on right now that I got a touch confused about because, unaware of them, I did not realize the distinction when I found them. The first is the documentation and videos provided by the project mentioned above. The second, &lt;SPAN class=CodePlexPageHeader id=ctl00_ctl00_Content_TabContentPanel_Content_TitleLabel&gt;&lt;A class="" title="WCF Security Guidance Package" href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=servicefactory&amp;amp;ReleaseId=8814" target=_blank mce_href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=servicefactory&amp;amp;ReleaseId=8814"&gt;WCF Security Guidance Package&lt;/A&gt;, is a Visual Studio based set of security automation tools -- and some documentation -- that help you apply the appropriate principles inside Visual Studio. Both are recommended, and I see them as complimentary. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN class=CodePlexPageHeader&gt;&amp;nbsp;If you find them useful or woefully inadequate, do let the projects know. They'll do their best to make them as useful as possible. Back to what I'm really interested in.... &lt;A class="" title="Web Service Software Factory: Modeling Edition" href="http://msdn2.microsoft.com/en-us/library/bb931187.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/bb931187.aspx"&gt;Web Service Software Factory: Modeling Edition&lt;/A&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8371177" width="1" height="1"&gt;</description></item><item><title>More about Descriptions</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2008/02/27/more-about-descriptions.aspx</link><pubDate>Wed, 27 Feb 2008 20:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7920790</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=7920790</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2008/02/27/more-about-descriptions.aspx#comments</comments><description>&lt;P&gt;I haven't posted for a while because I've been working on other stuff, and much of that work has encouraged me to think hard about the concept of the ServiceDescription class, the root of what is called the &lt;A class="" title="Description Hierarchy" href="http://blogs.msdn.com/ralph.squillace/archive/2006/10/26/the-description-tree-heirarchy.aspx" target=_blank mce_href="http://blogs.msdn.com/ralph.squillace/archive/2006/10/26/the-description-tree-heirarchy.aspx"&gt;Description Hierarchy&lt;/A&gt; that I posted about previously. The ServiceDescription object, when created, contains everything that is known about a WCF service, and is really all that is required by a ServiceHost to get one up and running. One could, if one wanted, override the&amp;nbsp;&lt;A class="" href="http://msdn2.microsoft.com/en-us/aa717533.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/aa717533.aspx"&gt;ServiceHostBase.CreateDescription&lt;/A&gt; method and return a ServiceDescription object that has been created live, right there. Many people do in fact do exactly this, populating a ServiceDescription from information contained in a file, or a database, or obtained from another Web service, for example. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Note: If you do this, make sure to override &lt;A class="" href="http://msdn2.microsoft.com/en-us/system.servicemodel.servicehostbase.applyconfiguration.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/system.servicemodel.servicehostbase.applyconfiguration.aspx"&gt;ApplyConfiguration&lt;/A&gt; also to return immediately, disabling configuration files. :-)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Of course, you could go the other way, overriding ApplyConfiguration in order to consume any arbitrary file or configuration system, doing the same thing. Imagine that you serialize an entire ServiceDescription object, and in ApplyConfiguration deserialize it and hand it off to the system. I'm using this thought game to point out that the totality of information necessary to execute a WCF service is **collected** from disparate sources and assimilated and validated into a ServiceDescription object, and then THAT is used to construct a service runtime and execute it (if possible). In the default case, the information lives in:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Attributes on the WCF service implementation. (ServiceContractAttribute, MessageContractAttribute, DataContractAttribute, ServiceBehaviorAttribute, and so on.)&lt;/LI&gt;
&lt;LI&gt;The structure of the implementation determined by managed reflection over the structure of the service implementation. (For example, WCF throws exceptions if you try to return two MessageContractAttribute types.)&lt;/LI&gt;
&lt;LI&gt;"Configuration" values contained in the configuration files, including behaviors and bindings and so on.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;In fact, if the WCF implementation didn't require some attributes on the implementation at runtime, it would be possible to build a system in which you implement an implementation without any attributes at all, and specify a huge amount of precise information in a very large configuration file. Then you could build a UI tool to handle that file more easily (SvcSuperConfigMaster.exe, anyone?) And then you could make that tool handle these configuration tables almost anywhere in a Windows domain -- or other domain, for that matter. The only thing you'd need to do at runtime, then, would be to point at an implementation that could be loaded at runtime and then configured from the SuperFile.config. &lt;/P&gt;
&lt;P&gt;In .NET 3.0, we did a good job of introducing a relatively straightforward way to both program and "model" -- another way of saying "specify" or "describe" -- the service and it's runtime information both in a managed assembly (attributes and structure) and in a description file (configuration file). I once mentioned to some of the product managers how all of this I saw as "metadata", almost the entire thing. They laughed and said, no, no, no. But I still think I'm right. :-)&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7920790" width="1" height="1"&gt;</description></item><item><title>The Description Tree Heirarchy</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/26/the-description-tree-heirarchy.aspx</link><pubDate>Thu, 26 Oct 2006 22:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:877279</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=877279</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/26/the-description-tree-heirarchy.aspx#comments</comments><description>&lt;P&gt;One of the things we didn't get a chance to write as much about as we wanted to by RTM -- but will fix soon -- is the description tree. The service-side description tree consists of the heirarchy of objects starting with &lt;A class="" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebservicesdescriptionservicedescriptionclasstopic.asp" target=_blank mce_href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebservicesdescriptionservicedescriptionclasstopic.asp"&gt;ServiceDescription&lt;/A&gt; class. The client-side description tree heirarchy starts from the&amp;nbsp;&lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.serviceendpoint.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.serviceendpoint.aspx"&gt;ServiceEndpoint&lt;/A&gt; class. &lt;/P&gt;
&lt;P&gt;Uh-oh: The first thing about these classes that you should know -- and notice if you followed the link for ServiceDescription is that there are TWO ServiceDescription classes in .NET Framework 3.0. The System.Web.Services.Description.ServiceDescription class represents metadata for a service in XML (and is used by WCF in some metadata-exclusive situations. Mail me if you want details). The ServiceDescription class that I want to discuss today is the &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.servicedescription.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.servicedescription.aspx"&gt;System.ServiceModel.Description.ServiceDescription&lt;/A&gt; class, which is the representation of everything that is known about a WCF service. This &lt;STRONG&gt;ServiceDescription&lt;/STRONG&gt; is used by WCF to create:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A service runtime, including listeners and behaviors that configure ru&amp;nbsp;ntime execution patterns when the runtime is built.&lt;/LI&gt;
&lt;LI&gt;WSDL and XSD files (including policy assertions) returned by ?wsdl HTTP Get requests or WS-MetadataExchange requests.&lt;/LI&gt;
&lt;LI&gt;Code that can represent compatible data types, contract interfaces,&amp;nbsp;and WCF client classes in addition to configuration files containing binding information.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Typically, the word &lt;EM&gt;metadata &lt;/EM&gt;in the Web services world means the WSDL/XSD and other associated XML files that describe the interoperable structures and signatures used to communicate -- that is, the stuff you get back from a ?wsdl querystring request. But of course, that kind of metadata is interoperable metadata because the language used to communicate it is public and any tool or platform can use it. Hopefully by now you know that this metadata describes a contract that an implementation must support in order to be usable by a client on another platform. If you take a step back, however, you should be able to see that an implementation -- for example, a WCF service implementation with configuration -- contains exactly the same information as its WSDL in addition to the information specific to the implementation. &lt;/P&gt;
&lt;P&gt;What is the sum total of all information about a WCF service? Well, naturally the contract must be modeled in code, typically as a service contract interface. In addition, a configuration file typically contains endpoint information in addition to any behaviors expected to run when the service is constructed. Where are these items brought together? Assuming a standard service application, when ServiceHost.Open is called a ServiceDescription is created -- and validated for contradictions that would prevent it from running -- that contains the totality of all information known about the service. In WCFs applications, the ServiceDescription object is effectively the internal WCF metadata for a WCF service. It can be converted into other "metadata" forms, such as a running service itself, code+configuration, and WSDL and XSD output. If you understand the ServiceDescription heirarchy, you'll understand all sorts of fun things about how WCF applications are configured, how they execute, and the forms into which such information can be put. The team doesn't necessarily think of the description tree as "uber-metadata" but I think doing so really helps. It helps you make some sense out of the fact that downloaded WSDL information (some of which is represented as XML-based System.Web.Services.Description.ServiceDescription information!) cannot simply be put into a System.ServiceModel.Description.ServiceDescription object, added to a ServiceHost, and run: they aren't the same things at all.&lt;/P&gt;
&lt;P&gt;Here's the entire tree, pretty much, in a single, large (~270KB) .png file. Have some fun with it. Remember, on the client side, the description tree starts with the ServiceEndpoint class.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://blogs.msdn.com/photos/ralphsquillace/images/877332/original.aspx" target=_blank&gt;&lt;IMG src="http://blogs.msdn.com/photos/ralphsquillace/images/877332/original.aspx" border=0&gt;&lt;/A&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=877279" width="1" height="1"&gt;</description></item><item><title>Sessionless Duplex Services, Part Two: Lifetimes and Contexts</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/19/sessionless-duplex-services-part-two-lifetimes-and-contexts.aspx</link><pubDate>Thu, 19 Oct 2006 20:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:845075</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=845075</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/19/sessionless-duplex-services-part-two-lifetimes-and-contexts.aspx#comments</comments><description>&lt;P&gt;Two posts ago I wrote the following &lt;A class="" href="http://blogs.msdn.com/ralph.squillace/archive/2006/10/10/Sessionless-duplex-services_3F00_-No-problem.-Small-issues_2C00_-yes_3B00_-problems_2C00_-no_2E00_.aspx" target=_blank mce_href="http://blogs.msdn.com/ralph.squillace/archive/2006/10/10/Sessionless-duplex-services_3F00_-No-problem.-Small-issues_2C00_-yes_3B00_-problems_2C00_-no_2E00_.aspx"&gt;post&lt;/A&gt; about how to build a duplex service and client that does NOT use sessions. Once I wrote the sample, I wanted to extend it to provide some more flexibility. I've done that now, but in so doing, I ran across some issues that make this type of service useful in only a couple of circumstances -- IMHO. However, I want to throw the newer version out there to demonstrate some programmatic areas and to see whether any of you can figure out what scenarios this type of service is useful.&lt;/P&gt;
&lt;P&gt;The first thing I wanted to do was to hook up custom extensions that tracked the lifetimes of the ServiceHost, the InstanceContext, and the IContextChannel when uses without sessions. To do this I used &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-gb/library/ms733816(VS.80).aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-gb/library/ms733816(VS.80).aspx"&gt;Extensible Objects&lt;/A&gt;&amp;nbsp;(objects that implement IExtensibleObject&amp;lt;T&amp;gt; to which objects that implement IExtension&amp;lt;T&amp;gt; (where T is the specific extensible object) can be added). Michele Leroux Bustamante has a simple example clearly implemented &lt;A class="" href="http://www.dasblonde.net/PermaLink,guid,9e9a2a7c-6cb6-461a-8d80-64fc189c55f9.aspx" target=_blank mce_href="http://www.dasblonde.net/PermaLink,guid,9e9a2a7c-6cb6-461a-8d80-64fc189c55f9.aspx"&gt;here&lt;/A&gt; if you want to examine how this works very quickly.&lt;/P&gt;
&lt;P&gt;I did the same thing. Here's the implementation for the ServiceHost tracker:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; class ServiceHostContext : IExtension&amp;lt;ServiceHostBase&amp;gt;, IDisposable&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Guid id;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ServiceHostContext()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { this.id = Guid.NewGuid(); }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { get { return this.id.ToString(); } }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region IExtension&amp;lt;ServiceHost&amp;gt; Members&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Attach(ServiceHostBase owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Attached to new ServiceHost.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Detach(ServiceHostBase owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { throw new Exception("The method or operation is not implemented."); }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region IDisposable Members&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Destroying service host: " + this.id);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;BR&gt;&amp;nbsp; }&lt;BR&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;This is made then used by a service behavior like so:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serviceHostBase.Extensions.Add(new ServiceHostContext());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;I addition, I have an instancecontext tracker:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public class MyInstanceContextExtension : IExtension&amp;lt;InstanceContext&amp;gt;&lt;BR&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Associate an Id with each Instance Created.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String instanceId;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public MyInstanceContextExtension()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { this.instanceId = Guid.NewGuid().ToString(); }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String InstanceId&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { return this.instanceId; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Attach(InstanceContext owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Attached to new InstanceContext.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Detach(InstanceContext owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Detached from InstanceContext.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;And this is added by and endpoint behavior (so it can be used on both sides!) that itself adds an instance context initializer. So it looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;public class MyInstanceContextInitializer : IInstanceContextInitializer&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Initialize(InstanceContext instanceContext, Message message)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyInstanceContextExtension extension = new MyInstanceContextExtension();&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add your custom InstanceContex extension that will let you associate state with this instancecontext&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instanceContext.Extensions.Add(extension);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;And finally let's track channels by creating an IContextChannel extension:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public class ChannelTrackerExtension : IExtension&amp;lt;IContextChannel&amp;gt;&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;snipExtraneousIdentifyingStuff /&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region IExtension&amp;lt;IContextChannel&amp;gt; Members&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Attach(IContextChannel owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Attached to new IContextChannel {0}.", owner.GetHashCode());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.channel = owner;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Detach(IContextChannel owner)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Detached from IContextChannel {0}.", owner.GetHashCode());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; }&lt;BR&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;And we use an endpoint behavior (again for both sides) that implements IChannelInitializer to detect the creation of channels.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public class ChannelInitializer : IChannelInitializer&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region IChannelInitializer Members&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Initialize(IClientChannel channel)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("IClientChannel.Initialize called.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; channel.Extensions.Add(new ChannelTrackerExtension());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;The service and endpoint behaviors all implement System.ServiceModel.Configuration.BehaviorExtensionElement so that they can be wired up using a configuration file. The other thing I've done is to update both the contract and the client. First, the contract now specifies one request/response service and has one one-way callback operation, like so:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; [ServiceContract(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = "SampleDuplexHello",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Namespace = "http://microsoft.wcf.documentation",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CallbackContract = typeof(IHelloCallbackContract),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SessionMode = SessionMode.NotAllowed&lt;BR&gt;&amp;nbsp; )]&lt;BR&gt;&amp;nbsp; public interface IDuplexHello&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string Hello(string greeting);&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public interface IHelloCallbackContract&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract(IsOneWay = true)]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Reply(string responseToGreeting);&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;The client application now creates a new object for each client proxy. This is an artifact of the fact that it's a console application; if it were a Windows Form or WPF application I wouldn't need to do this. But while I was building it out, I stumbled across some interesting behavior that illuminates what is going on. The host creates a new Client object for each connection it wants to make:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public class ClientApp&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void Main()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client client = new Client();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Run();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client = new Client();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Run();&lt;BR&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;And each Client object creates an AutoResetEvent to hold open the client until all callbacks are received and then in Run() creates a duplex client, invokes the request/reply operation and waits for the callbacks.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp; public void Run()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Picks up configuration from the config file.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceContext callbackInstanceContext = new InstanceContext(this);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleDuplexHelloClient wcfClient = new SampleDuplexHelloClient(callbackInstanceContext);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (OperationContextScope opScope = new OperationContextScope(wcfClient.InnerDuplexChannel))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // add replyto&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(wcfClient.InnerDuplexChannel.LocalAddress.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.ReplyTo&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = wcfClient.InnerDuplexChannel.LocalAddress;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.White;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Enter a greeting to send and press ENTER: ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("&amp;gt;&amp;gt;&amp;gt; ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Green;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string greeting = Console.ReadLine();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.White;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Called service with: \r\n\t" + greeting);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Cyan;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(wcfClient.Hello(greeting));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.waitHandle.WaitOne();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Set was called.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (TimeoutException timeProblem)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("The service operation timed out. " + timeProblem.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcfClient.Abort();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (CommunicationException commProblem)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("There was a communication problem. " + commProblem.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcfClient.Abort();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;The callback (Reply()) remains the same. Now we can talk. As soon as I figure out how to post .zips I will. Anyway, the service now looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp; public string Hello(string greeting)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Green;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Caller sent: " + greeting);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Session ID: " + OperationContext.Current.SessionId);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string response = "Service object " + this.GetHashCode().ToString() + " received: " + greeting;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Generate five callbacks&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CallbackArguments args = new CallbackArguments();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.numCallbacks = 5;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.to = OperationContext.Current.IncomingMessageHeaders.ReplyTo.Uri;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.callerClient &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = OperationContext.Current.GetCallbackChannel&amp;lt;IHelloCallbackContract&amp;gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.incomingHeaders &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = OperationContext.Current.IncomingMessageHeaders.ReplyTo.Headers;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do this on another thread.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Threading.ThreadPool.QueueUserWorkItem(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new WaitCallback(DuplexHello.GenerateCallbacks), args&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.Sleep(1000);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //DuplexHello.GenerateCallbacks(args);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return String.Format("Hi there. You sent {0}.", greeting);&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Note that I have a GenerateCallbacks method that&amp;nbsp;is supposed to invoke five callbacks to the caller (you can do this either on this thread or another). Note, also, that the request/reply portion of the call is handled simply by returning. The only thing of interest here is the callbacks generated by the service. For this, recall that we needed to add the inbound ReplyTo value to the outbound To header. But -- and this is one of those interesting things, when we did TWO separate clients, the second client failed to see the response and the service did send the messages. What happened?&lt;/P&gt;
&lt;P mce_keep="true"&gt;What happened is that the first request does not need to append any address information to the callback To header. But &lt;STRONG&gt;&lt;EM&gt;subsequent&lt;/EM&gt; &lt;/STRONG&gt;callbacks DO append information, and that extra information does need to be appended. So here's the simple way to do this in GenerateCallbacks:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static void GenerateCallbacks(object parameters)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CallbackArguments args = parameters as CallbackArguments;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IHelloCallbackContract callerClient&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = args.callerClient;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContextScope callbackOpContext&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = new OperationContextScope((IContextChannel)callerClient)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.To = args.to;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (AddressHeader ah in args.incomingHeaders)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // deal with ref params&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.Add(ah.ToMessageHeader());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;We assign the To and then we take any extra information coming in from the client instance and make sure to add that information as well. In this case, the extra information is that on subsequent calls the client creates listeners on addresses that make use of &lt;EM&gt;reference parameters&lt;/EM&gt; and these, too, must be added to the outbound headers collection. Whoohooo!&lt;/P&gt;
&lt;P mce_keep="true"&gt;Now, let's make our callbacks.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i = 0; i &amp;lt; args.numCallbacks; ++i)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("callback {0} to: {1}", i, args.to);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; callerClient.Reply(String.Format("Notification {0}.", i.ToString()));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (TimeoutException timeout)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("There was a timeout exception on a callback.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (CommunicationException commException)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("CommunicationException: {0}", commException.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("General exception: {0}.", ex.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Great, right? Um, no. Here's another interesting thing. The default service InstanceContextMode is PerSession. But we aren't using a session, remember? The behavior we get in this case ends up being "PerCall". So if we return from the operation &lt;EM&gt;prior to the completion of the callbacks&lt;/EM&gt; you can guess what happens: The callbacks don't get there because the service infrastructure has cleaned up the operation context and service channel from underneath us. &lt;/P&gt;
&lt;P mce_keep="true"&gt;One fix is to do what I did here: Throw a Thread.Sleep in the operation to enable the callbacks to reach their destination successfully. Obviously this is just a mitigation for the example. Try it yourself without the Sleep and see what you get. The other way to handle this is to realize that the service InstanceContextMode could be single, in which case the underlying service channel stays around for all clients. Mix and match solutions and enjoy yourself.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Let's get back to the extensions that track lifetimes. One of the things that building the sample this way accomplishes is to establish what happens on each side when multiple clients run. First of all, each client callback address is different, so clients are still separate entities for the purposes of duplex calls. We can see that for each new Client object, you get a brand new channel. For the service, however, &lt;EM&gt;there is only ever one channel for the lifetime of the service host with the exception of any timeouts.&lt;/EM&gt; When the InstanceContextMode is functionally PerCall, you get the following:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Attached to new ServiceHost.&lt;BR&gt;Channel tracker added.&lt;BR&gt;The service is ready.&lt;BR&gt;Press &amp;lt;ENTER&amp;gt; to terminate service.&lt;/P&gt;
&lt;P mce_keep="true"&gt;IClientChannel.Initialize called.&lt;BR&gt;Attached to new IContextChannel 42132014.&lt;BR&gt;Attached to new InstanceContext.&lt;BR&gt;Service object created: 45155606&lt;BR&gt;Caller sent: Hello.&lt;BR&gt;Session ID:&lt;BR&gt;callback 0 to: http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;callback 1 to: http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;callback 2 to: http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;callback 3 to: http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;callback 4 to: http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;Service object destroyed: 45155606&lt;BR&gt;Attached to new InstanceContext.&lt;BR&gt;Service object created: 29447802&lt;BR&gt;Caller sent: Hello again.&lt;BR&gt;Session ID:&lt;BR&gt;callback 0 to: http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;callback 1 to: http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;callback 2 to: http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;callback 3 to: http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;callback 4 to: http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;Service object destroyed: 29447802&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;You can see that we get a new IntanceContext and service object for each call. But only one service channel is ever created. It's this channel that must be available for the callbacks. This means, also, that you cannot call Close on it when you're done with your callbacks. Go ahead: Close it and see what happens -- you're going to need it again later. ;-)&lt;/P&gt;
&lt;P mce_keep="true"&gt;The client, however, has channels appearing all over. OK, for each new client:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Channel tracker added.&lt;BR&gt;IClientChannel.Initialize called.&lt;BR&gt;Attached to new IContextChannel 44419000.&lt;BR&gt;http://localhost:8081/Callback/cea9fe7f-c3a6-41cf-9151-c54b1404d5b5&lt;BR&gt;Enter a greeting to send and press ENTER:&lt;BR&gt;&amp;gt;&amp;gt;&amp;gt; Hello first.&lt;BR&gt;Called service with:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hello first.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 0.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 1.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 2.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 3.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 4.&lt;BR&gt;Hi there. You sent Hello first..&lt;BR&gt;Set was called.&lt;BR&gt;Channel tracker added.&lt;BR&gt;IClientChannel.Initialize called.&lt;BR&gt;Attached to new IContextChannel 59109011.&lt;BR&gt;http://localhost:8081/Callback/99928a92-2d3c-42cc-bd1b-34af14cc737b&lt;BR&gt;Enter a greeting to send and press ENTER:&lt;BR&gt;&amp;gt;&amp;gt;&amp;gt; Hello second.&lt;BR&gt;Called service with:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hello second.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 0.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 1.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 2.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 3.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Notification 4.&lt;BR&gt;Hi there. You sent Hello second..&lt;BR&gt;Set was called.&lt;BR&gt;Press ENTER to exit...&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Now, I think that based on what we've discovered that this a) isn't the application structure you'd want if you were building a sessionless duplex service and client, and b) that if you built it correctly it would still only be useful in limited scenarios given how hard you have to work to correlate things AND managed service infrastructure lifetimes. Because Christian Weyer had asked me about the sessionless duplex possibility before, now I'm going to challenge him to take a stance: How should this application be built, and once it's built correctly, what scenarios can make use of it? Christian?&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;UPDATE: I forgot one other critical little piece. Note that in the callback section I generate a new OperationContext that is not the one used with request/reply. Why? Because if I use the same one I'll set the To values for the request/reply operation as well as the oneway callback -- and that would muck with the response to the operation. Therefore I only need to set the callback headers for the callback context. That's why I do that.....&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=845075" width="1" height="1"&gt;</description></item><item><title>Quick WCF Metadata Publication Walkthrough</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/19/quick-wcf-metadata-publication-walkthrough.aspx</link><pubDate>Thu, 19 Oct 2006 19:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:844913</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=844913</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/19/quick-wcf-metadata-publication-walkthrough.aspx#comments</comments><description>&lt;p&gt;I've been having a conversation with Scott Klein, who is busy writing a book on WCF (&lt;a href="http://www.amazon.com/Professional-WCF-Pr%20ogramming-Development-Communication/dp/0470089849/sr=1-2/qid=1161195651/ref=sr_1_2/102-4898838-8936%20108?ie=UTF8&amp;amp;s=books" mce_href="http://www.amazon.com/Professional-WCF-Pr%20ogramming-Development-Communication/dp/0470089849/sr=1-2/qid=1161195651/ref=sr_1_2/102-4898838-8936%20108?ie=UTF8&amp;amp;s=books"&gt;http://www.amazon.com/Professional-WCF-Pr%20ogramming-Development-Communication/dp/0470089849/sr=1-2/qid=1161195651/ref=sr_1_2/102-4898838-8936%20108?ie=UTF8&amp;amp;s=books&lt;/a&gt;). He'd been reading and following the documentation about publishing service metadata and had figured out how to do this in code, but for some reason he just didn't understand the errors resulting from his attempt to use the configuration file to do the same thing. Even the book writers don't get things first time! (But that's likely because I need to do a better job writing about it. ;-)&lt;/p&gt;
&lt;p&gt;We got in a conversation about this, and it seemed to me that a couple of things made it difficult for him to pick up how this works.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the programmatic version, you don't usually have to think about the base addresses; in config, you usually do.&lt;/li&gt;
&lt;li&gt;The fact that HTTP/GET publication just "happens" but WS-MetadataExchange is a real contract with real endpoints.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With Scott's permission, I'm republishing the majority (minus the embarrasing dumb stuff I wrote here and there and with some small edits for sensibility) of a mail to Scott that walks through the process of taking a standard application configuration file and adding different sorts of metadata publication as we go along until at the end we're publishing service metadata at a HTTP/GET address using the ?wsdl convention AND over both HTTP and TCP using WS-MetadataExchange requests. The critical things to watch for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All metadata publication using relative addressing requires supporting base addresses for the ServiceHost; otherwise, you can use absolute addresses.&lt;/li&gt;
&lt;li&gt;HTTP/GET publication is&amp;nbsp;an "artifact" of the ServiceMetadataBehavior and the HttpGetEnabled property.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a side note, because the ServiceMetadataBehavior is a service behavior, it must be not only specified in the configuration file but also referenced by the \service@behaviorConfiguration&amp;nbsp;attribute.&lt;/p&gt;
&lt;p&gt;Here we go (and if you walk through this and catch me in a typo, let me know and I'll fix it!):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span&gt;&lt;strong&gt;From:&lt;/strong&gt; Ralph Squillace &lt;br /&gt;&lt;strong&gt;Sent:&lt;/strong&gt; Tuesday, October 17, 2006 10:42 AM&lt;br /&gt;&lt;strong&gt;To:&lt;/strong&gt; 'Scott Klein'&lt;br /&gt;&lt;strong&gt;Subject:&lt;/strong&gt; RE: ServiceMetadata -- the big picture and walkthrough&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;!--?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" ?--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;lt;snip stupid stuff I wrote/&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Automatic metadata publication must have an address at which to publish. A ServiceHost is not tied to any particular application domain. This means that unlike ASMX files, which always reside at an IIS virtual directory (for example, http://computer/vDirectory), ServiceHost when opened &lt;i&gt;does not know where it is.&lt;/i&gt; It must therefore be passed (or infer from absolute addressing) a &amp;ldquo;base&amp;rdquo; or &amp;ldquo;root&amp;rdquo; address to which all relative addresses used by the host are appended.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;When a Service.svc file is hosted in IIS/WAS, the ServiceHost acquires the base address from IIS/WAS, and is therefore automatically whatever the virtual directory is, just like ASMX, plus the &amp;ldquo;Service.svc&amp;rdquo; relative address that points to the service implementation. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;In all other cases, you must provide a &lt;i&gt;base address &lt;/i&gt;in order for automatic metadata publication to work &lt;i&gt;&lt;span style="text-decoration: underline;"&gt;unless you supply an absolute address in your endpoints or for the httpGetUrl property&lt;/span&gt;&lt;/i&gt;&lt;span style="text-decoration: underline;"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="text-decoration: underline; color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;o:p&gt;&lt;span style="text-decoration: none;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Let&amp;rsquo;s walk through this. Let&amp;rsquo;s say you haven&amp;rsquo;t configured any metadata for your service yet and it looks like the following. What is the address for this service?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;The answer is that this throws an exception on Open because no base address exists to create this class &lt;i&gt;unless hosted in IIS/WAS, in which case the service is hosted at the virtual directory&lt;/i&gt;. In all other cases, this service throws.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;We **could** do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="&lt;strong&gt;&lt;span style="font-family: Arial;"&gt;http://computer/Services/SampleService&lt;/span&gt;&lt;/strong&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Now the service WILL be published, but at http://computer/Services/SampleService because we specified an absolute address. Trick question: what is the base address? The answer is that there isn&amp;rsquo;t one here. There may be one passed to the ServiceHost programmatically, but let's assume that's not the case here.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;OK, this runs, now let&amp;rsquo;s add metadata support for HTTP/GET. We do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="http://computer/Services/SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;&lt;span style="font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;What has changed? The ServiceMetadataBehavior is loaded and we&amp;rsquo;ve told it to publish HTTP/GET metadata at the address &lt;i&gt;baseHttpAddress + httpGetUrl&lt;/i&gt; (because the address we&amp;rsquo;ve specified there is relative) + &amp;ldquo;?wsdl&amp;rdquo;. There are two problems here. First, we haven&amp;rsquo;t specified this behavior for any service in the configuration file yet, so it&amp;rsquo;s loaded but not invoked. Second, even when we specify the &amp;ldquo;metadataSupport&amp;rdquo; behavior in &lt;strong&gt;&lt;span style="font-family: Arial;"&gt;&amp;lt;service behaviorConfiguration=&amp;rdquo;metadataSupport&amp;rdquo;/&amp;gt;&lt;/span&gt;&lt;/strong&gt; property, we&amp;rsquo;ll throw because &amp;ndash; of course &amp;ndash; the host does not HAVE an HTTP-based base address. How can we make this work? Well, we can specify an &lt;i&gt;absolute address&lt;/i&gt;. Like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; behaviorConfiguration=&amp;rdquo;metadataSupport&amp;rdquo;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="http://computer/Services/SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Arial;" lang="IT"&gt;&amp;lt;serviceMetadata httpGetEnabled="true" httpGetUrl="http://computer/Services/SampleService/Metadata"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;" lang="IT"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;lt;/behavior&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Note that here we now provide an absolute address for the HttpGetUrl property (and the behavior is wired up to the service) so that you can view the metadata at &amp;ldquo;http://computer/Services/SampleService/Metadata?wsdl&amp;rdquo;. But this is fairly fragile. What we WANT to do is to specify the base addresses so that we can use relative ones. Now we use the base addresses stuff. We do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; behaviorConfiguration="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&lt;span style="font-family: Arial;"&gt;&amp;lt;add baseAddress="http://localhost:8080/SampleService" /&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Arial;" lang="IT"&gt;contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;" lang="IT"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Here we have specified that there is a base address of http://localhost:8080/SampleService. Note that the service endpoint HTTP-based address is empty and that it&amp;rsquo;s relative (because it&amp;rsquo;s not absolute), so the service is available at the base address. &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ol type="1"&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;The ServiceMetadataBehavior is there...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;...AND it&amp;rsquo;s wired up to the service&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;...AND the HttpGetUrl property is empty (and therefore relative)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;...AND because the http/GET protocol requires an HTTP-transport based base address &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;...AND the base address IS an Http-based address&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;THEREFORE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt; we can now see the metadata using a browser at http://localhost:8080/SampleService?wsdl. Whew. Lot's of ANDs.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Can we use WS-MetadataExchange yet? No. Can we retrieve metadata from any other transport? No. At this point we only support HTTP/GET at the previously mentioned address. Now let&amp;rsquo;s add WS-MetadataExchange support. We now add a &lt;i&gt;metadata endpoint&lt;/i&gt;, one in which the contract is IMetadataExchange, the binding supports HTTP, and a relative (or absolute!) address. Here we go:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;" lang="IT"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;" lang="IT"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;behaviorConfiguration="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="http://localhost:8080/SampleService" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="mex"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="mexHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IMetadataExchange"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;We have added a metadata endpoint with the relative address &amp;ldquo;mex&amp;rdquo; (therefore we must have a supporting base address -- and we do), specified the mexHttpBinding (for basic HTTP support -- and the base address IS an HTTP-based address, so we're OK there), and referenced the IMetadataExchange contract. You can now (in addition to using HTTP/GET as before) point svcutil at http://localhost:8080/SampleService/mex and it will retrieve the metadata content in a WS-MEX message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Now, do we have HTTP/GET support? Yes. Do we have WS-Mex support over HTTP? Yes. Do we have WS-Mex support over TCP? No. To do that, we&amp;rsquo;ll add another endpoint that uses TCP, like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.SampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; behaviorConfiguration="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="http://localhost:8080/SampleService" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address=""&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.ISampleService"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="mex"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="mexHttpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IMetadataExchange"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="tcpmex"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="mexTcpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IMetadataExchange"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="metadataSupport"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;/serviceBehaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Now then, what happens when we run svcutil against net.tcp://localhost:8080/SampleService/tcpmex? We should get 300 exceptions, as you did (OK, it&amp;rsquo;s really just one). Why? You can guess: The service host &lt;i&gt;does not have a TCP-transport base address&lt;/i&gt; AND the TCP-based metadata endpoint uses a &lt;i&gt;relative address&lt;/i&gt;. Had we specified an absolute address there:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="&lt;strong&gt;&lt;span style="font-family: Arial;"&gt;net.tcp://localhost:8081/SampleService/tcpmex&lt;/span&gt;&lt;/strong&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="mexTcpBinding"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IMetadataExchange"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;We would have been able to point svcutil at net.tcp://localhost:8081/SampleService/tcpmex and it will work fine. But again, absolute addresses are bad. So how do we use relative addresses? &lt;i&gt;We add a tcp-transport based base address, like so&lt;/i&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="http://localhost:8080/SampleService" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress=&amp;rdquo;net.tcp://localhost:8081/SampleService&amp;rdquo; /&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;NOW we can point to net.tcp://localhost:8081/SampleService/tcpmex and it will work fine. From here you should be able to add any other WS-MEX endpoint AND you should be able to understand what to check when it doesn&amp;rsquo;t work. Let&amp;rsquo;s look at the exception you got in your example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: 'Courier New';"&gt;"Could not find a base address that matches scheme &lt;b&gt;net.tcp&lt;/b&gt; for the endpoint with binding MetadataExchange&lt;b&gt;Tcp&lt;/b&gt;Binding. Registered base address schemes are []."&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;lt;snip from Scott's&amp;nbsp;mail with permission&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;So, I added the following section:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress = "net.pipe://localhost/"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress ="net.tcp://localhost:8000/"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&amp;lt;/host&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;Now I get the following on sh.Open()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;ldquo;The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address.&amp;nbsp; Either supply an http base address or set HttpGetUrl to an absolute address.&amp;rdquo;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;lt;/snip from Scott's&amp;nbsp;mail with permission&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;The answer here is that you&amp;rsquo;ve set the &lt;strong&gt;&lt;span style="font-family: Arial;"&gt;HttpGetEnabled&lt;/span&gt;&lt;/strong&gt; property to &lt;strong&gt;&lt;span style="font-family: Arial;"&gt;true&lt;/span&gt;&lt;/strong&gt; BUT you have no &amp;lt;add baseAddress=/&amp;gt; property that supports HTTP. We have no transport to use for HTTP! You can either:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ol style="margin-top: 0in;" type="1"&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l1 level1 lfo2; tab-stops: list .5in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;Set the HttpGetUrl property to an absolute address OR&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="MsoNormal" style="margin: 0in 0in 0pt; color: white; mso-list: l1 level1 lfo2; tab-stops: list .5in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial; color: #333333;"&gt;add a HTTP-based base address to the &amp;lt;baseAddresses&amp;gt; element.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt; tab-stops: list .5in;"&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;This put everything in perspective for Scott, who immediately went on to bigger and better things, but I wanted to make sure that no one else got stalled out by the simple service requirement. Two other notes. First, if you're wondering where the implementation of the IMetadataExchange contract is (because you know you didn't build one!) it's in the ServiceMetadataExtension, which the behavior adds to the ServiceHost. Second, here we added HTTP and TCP metadata support. But if you're following the abstract point, you should see that an IME endpoint &lt;em&gt;&lt;span style="font-family: Arial;"&gt;can be any endpoint&lt;/span&gt;&lt;/em&gt;. You can secure it; auth it; encrypt it; whatever you want. We provide four basic supporting metadata bindings, but you can create custom bindings, too. Hope this all helps! I'll be folding this information back into the documentation as soon as I can...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt; tab-stops: list .5in;"&gt;&lt;span style="font-size: small; color: #333333;" size="3"&gt;&lt;span style="font-family: Times New Roman;" face="Times New Roman"&gt;&amp;nbsp;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: #333333; font-family: Arial;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=844913" width="1" height="1"&gt;</description></item><item><title>Sessionless duplex services? No problem. Small issues, yes; problems, no.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/10/sessionless-duplex-services_3F00_-no-problem.-small-issues_2C00_-yes_3B00_-problems_2C00_-no_2E00_.aspx</link><pubDate>Wed, 11 Oct 2006 06:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:815883</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=815883</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/10/sessionless-duplex-services_3F00_-no-problem.-small-issues_2C00_-yes_3B00_-problems_2C00_-no_2E00_.aspx#comments</comments><description>&lt;P&gt;&lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/ms731184.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/ms731184.aspx"&gt;Duplex&lt;/A&gt; is neato, definitely, because among other things it allows a service to push information at clients as it sees fit. You could just have two services, and one service throws an endpoint at the other and then listens for stuff coming back, too, but there are scenarios for this and scenarios for that. Sometimes a duplex client is the perfect thing but you don't really want the session that comes with the system-provided duplex-supporting bindings used to wire up the two-way communication system. For example, &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspx"&gt;WsDualHttpBinding&lt;/A&gt; uses a secure conversation session by default and a &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/ms730123.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/ms730123.aspx"&gt;reliable session&lt;/A&gt; if you turn it on; and the &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx"&gt;NetTcpBinding&lt;/A&gt; surfaces a session associated with the underlying TCP connection. &lt;/P&gt;
&lt;P&gt;The problem with these is that there are some session lifetime and creation issues that you have to manage when you use sessions. What's the timeout period? What do I do when Abort happens? And so on. Wouldn't it be nice of you could do duplex without session overhead? Well, you can. But you may want to consider why you want to before you do it. I'll wait to see when &lt;A class="" href="http://blogs.thinktecture.com/cweyer/" target=_blank mce_href="http://blogs.thinktecture.com/cweyer/"&gt;Christian&lt;/A&gt; thinks it might be helpful. ;-)&lt;/P&gt;
&lt;P&gt;A duplex contract is merely a service contract in which there are some operations that specify outbound calls from the service to the client. And a duplex client, then, is merely a WCF application that also hosts a client-side listener for return calls from the service to which it is connected. A client runtime is exposed for use by the -- surprise -- &lt;A class="" title=ClientRuntime href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.aspx"&gt;ClientRuntime&lt;/A&gt; class. If the client is a duplex client, however, it also hosts a service runtime, exposed for inspection or modification as a &lt;A class="" title=DispatchRuntime href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.aspx"&gt;DispatchRuntime&lt;/A&gt;&amp;nbsp;object available from the &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.callbackdispatchruntime.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.clientruntime.callbackdispatchruntime.aspx"&gt;ClientRuntime.CallbackDispatchRuntime&lt;/A&gt; property. This exposes the entire service side runtime and can be thought of as a service in your client application but for one major exception: It cannot be activated by a call from a service. It must connect to a service first, and then it listens for callbacks from that service. In the WCF system-provided duplex bindings, the information about the callback listener is transferred to the service (so that the service knows where to direct the callback invocations) using the provided session support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Therefore, when -- for your own twisted reasons -- you want to build a sessionless duplex application, you have to do a little extra lifting. But not that much. Here's how to build a simple duplex application that does not establish a session using the HTTP transport and a few extra gadgets. First, let's get you up and running, and then we'll post more later about how this works and how to modify it. Or maybe someone will beat me to that.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Big Fat Warning. &lt;/STRONG&gt;This sample does not do security. You'd be a fool to think it does, so don't think that. &lt;/P&gt;
&lt;P&gt;OK, onward. First, a simple duplex contract.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp; [ServiceContract(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = "SampleDuplexHello",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Namespace = "&lt;A href="http://microsoft.wcf.documentation/"&gt;http://microsoft.wcf.documentation&lt;/A&gt;",&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CallbackContract = typeof(IHelloCallbackContract),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SessionMode = SessionMode.NotAllowed&lt;BR&gt;&amp;nbsp; )]&lt;BR&gt;&amp;nbsp; public interface IDuplexHello&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract(IsOneWay = true)]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Hello(string greeting);&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; public interface IHelloCallbackContract&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationContract(IsOneWay = true)]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Reply(string responseToGreeting);&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Note that the ServiceContractAttribute.SessionMode property is set to SessionMode.NotAllowed. This means that if we make a mistake and supply a sessionful binding, the application throws an exception.&amp;nbsp;Here is the service implementation.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; public class DuplexHello : IDuplexHello, IDisposable&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DuplexHello()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Service object created: " + this.GetHashCode().ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Hello(string greeting)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Caller sent: " + greeting);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Session ID: " + OperationContext.Current.SessionId);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Waiting two seconds before returning call.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Put a slight delay to demonstrate asynchronous behavior on client.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.Sleep(2000);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the callback client object.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IHelloCallbackContract caller&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = OperationContext.Current.GetCallbackChannel&amp;lt;IHelloCallbackContract&amp;gt;();&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Fetch out the client ReplyTo and place it in the outbound To header to &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // direct the callback message.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Uri to = new Uri(OperationContext.Current.IncomingMessageHeaders.ReplyTo.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.To = to;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string response = "Service object " + this.GetHashCode().ToString() + " received: " + greeting;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Sending back: " + response);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; caller.Reply(response);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #region IDisposable Members&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Service object destroyed: " + this.GetHashCode().ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;BR&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;If you've built a duplex application before, the only interesting code here is the&amp;nbsp;section in which we&amp;nbsp;find the incoming&amp;nbsp;ReplyTo header and assign that value&amp;nbsp;to the outgoing To header.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Fetch out the client ReplyTo and place it in the outbound To header to &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // direct the callback message.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Uri to = new Uri(OperationContext.Current.IncomingMessageHeaders.ReplyTo.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.To = to;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;With the default sessionful bindings, you don't have to take this step. But without those sessions to help out, you do. If this application structure is important to you, you'd probably handle this wiring procedure in a combination extensible object and &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx"&gt;IDispatchMessageInspector&lt;/A&gt;. Here we simply do this in code.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;Now the tricky part. I'll just tell you how to build the binding and get back to discussing this later. We're going to layer a &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.compositeduplexbindingelement.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.compositeduplexbindingelement.aspx"&gt;CompositeDuplexBindingElement&lt;/A&gt; over a &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.onewaybindingelement.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.onewaybindingelement.aspx"&gt;OneWayBindingElement&lt;/A&gt; on top of a &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement.aspx"&gt;HttpTransportBindingElement&lt;/A&gt;. Oh yeah, we need an encoder, too. OK, let's use the default &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement.aspx"&gt;TextMessageEncodingBindingElement&lt;/A&gt; for that. I find config easier for this than code, so we'll assemble this binding using the &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.custombinding.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.channels.custombinding.aspx"&gt;CustomBinding&lt;/A&gt;. It looks like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;BR&gt;&amp;lt;configuration&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="Microsoft.WCF.Documentation.DuplexHello"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; behaviorConfiguration="mex"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="http://localhost:8080/DuplexHello"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address=""&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="customBinding"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bindingConfiguration="duplexNoSession" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="Microsoft.WCF.Documentation.IDuplexHello"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="mex"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="mexHttpBinding"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IMetadataExchange"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;bindings&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;customBinding&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;binding name="duplexNoSession"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;compositeDuplex /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oneWay/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;textMessageEncoding /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;httpTransport /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/binding&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/customBinding&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/bindings&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name="mex" &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled="true" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;BR&gt;&amp;lt;/configuration&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;Note that here I enable metadata using the &lt;A class="" href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.servicemetadatabehavior.aspx" target=_blank mce_href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.servicemetadatabehavior.aspx"&gt;ServiceMetadataBehavior&lt;/A&gt;. Downloading and creating the client remains pretty simple. Now, create a host:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a ServiceHost for the service type and use the base address from configuration.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (ServiceHost serviceHost = new ServiceHost(typeof(DuplexHello)))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open the ServiceHostBase to create listeners and start listening for messages.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serviceHost.Open();&lt;BR&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;and you're running. Let's get to&amp;nbsp;the client, and then I'll sign off&amp;nbsp;for now. Use Svcutil.exe to generate client code. Once you do that, the&amp;nbsp;trick to the client is that you must create a new OperationContextScope to set the outbound ReplyTo header. Then, pass the local address of the underlying channel to the ReplyTo header and invoke the client.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Picks up configuration from the config file.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceContext callbackInstanceContext = new InstanceContext(this);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleDuplexHelloClient wcfClient = new SampleDuplexHelloClient(callbackInstanceContext);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (OperationContextScope opScope = new OperationContextScope(wcfClient.InnerDuplexChannel))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add explicit replyto for the other side to pick up.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.ReplyTo&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = wcfClient.InnerChannel.LocalAddress;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;In duplex clients&amp;nbsp;you need to hold the application domain open to listen for callbacks. Without a session to fault, if a client vanishes the service will not know about it until a callback fails. The upside, however, is that &lt;EM&gt;the channel is not like to fault&lt;/EM&gt;. Typically, if a callback fails, your service can simply ignore that result or retry the call on the same channel later. This is a handy way of getting services to support eventish behavior for client applications without worrying unduly about the channel lifetime and infrastructure. The complete client application follows. I learned most of this to write documentation for duplex applications but I was guided mainly by &lt;A class="" href="http://blogs.msdn.com/drnick/" target=_blank mce_href="http://blogs.msdn.com/drnick/"&gt;Dr. Nick&lt;/A&gt; and &lt;A class="" href="http://www.kennyw.com/" target=_blank mce_href="http://www.kennyw.com"&gt;Kenny Wolf&lt;/A&gt;, who have written in their blogs about pieces and helped me understand how they go together to make this work. If I have to repost to clarify or modify what I've said, it's not their fault. :-) More soon.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;using System;&lt;BR&gt;using System.ServiceModel;&lt;BR&gt;using System.ServiceModel.Channels;&lt;BR&gt;using System.Threading;&lt;/P&gt;
&lt;P mce_keep="true"&gt;namespace Microsoft.WCF.Documentation&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; public class Client : SampleDuplexHelloCallback&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoResetEvent waitHandle;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Client()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; waitHandle = new AutoResetEvent(false);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Run()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Picks up configuration from the config file.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InstanceContext callbackInstanceContext = new InstanceContext(this);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleDuplexHelloClient wcfClient = new SampleDuplexHelloClient(callbackInstanceContext);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (OperationContextScope opScope = new OperationContextScope(wcfClient.InnerDuplexChannel))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add explicit replyto for the other side to pick up.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationContext.Current.OutgoingMessageHeaders.ReplyTo&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = wcfClient.InnerChannel.LocalAddress;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.White;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Enter a greeting to send and press ENTER: ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("&amp;gt;&amp;gt;&amp;gt; ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Green;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string greeting = Console.ReadLine();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.White;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Called service with: \r\n\t" + greeting);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcfClient.Hello(greeting);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Execution passes service call and the client waits.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.waitHandle.WaitOne();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Set was called.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (TimeoutException timeProblem)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("The service operation timed out. " + timeProblem.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Sessionful channels should abort the channel unless it is a &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // specified fault. This duplex sample uses a datagram channel, which should be &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // reusable.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcfClient.Close();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (CommunicationException commProblem)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("There was a communication problem. " + commProblem.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Sessionful channels should abort the channel unless it is a &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // specified fault. This duplex sample uses a datagram channel, which should be &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // reusable.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcfClient.Close();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("Press ");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("ENTER");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ResetColor();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(" to exit...");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ReadLine();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void Main()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client client = new Client();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Run();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Reply(string response)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Received output.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("\r\n\t" + response);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.waitHandle.Set();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp; }&lt;BR&gt;}&lt;BR&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=815883" width="1" height="1"&gt;</description></item><item><title>Last note on the return of WCF client objects.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/10/last-note-on-the-return-of-wcf-client-objects_2E00_.aspx</link><pubDate>Wed, 11 Oct 2006 00:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:814385</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=814385</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/10/10/last-note-on-the-return-of-wcf-client-objects_2E00_.aspx#comments</comments><description>It would best be said, in the end, that a client object returns from an operation call (including a one-way operation) when the outbound message is sent by the transport. This can be a network call, but need not be. The most obvious example is handing the message off to a message queue. Sigh. I think this one is done now.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=814385" width="1" height="1"&gt;</description></item><item><title>OperationContractAttribute.IsOneWay: One more blocking scenario. </title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/08/04/688771.aspx</link><pubDate>Fri, 04 Aug 2006 21:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:688771</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=688771</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/08/04/688771.aspx#comments</comments><description>&lt;P&gt;As I mentioned in the previous post, there are scenarios in which one-way operations can block a client. After investigation I've discovered yet another, shown to me by John Justice, &lt;A href="http://blogs.msdn.com/mjm/default.aspx"&gt;Michael Marucheck&lt;/A&gt;, and &lt;A href="http://blogs.msdn.com/edpinto/"&gt;Ed Pinto&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;The scenario is quite specific. The client can block on the service when the &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx"&gt;ConcurrencyMode&lt;/A&gt; is set to ConcurrencyMode.Single and the binding has established a session of any type (that is, it implements &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/ms596746.aspx"&gt;ISessionChannel&amp;lt;ISession&amp;gt;&lt;/A&gt;). The reason is that in this case, the dispatcher enforces ordering on such messages. For example, in the case of HTTP-based one-way operations (remember that &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.wshttpbinding.aspx"&gt;WSHttpBinding&lt;/A&gt; is the recommended default binding), a first message comes in&amp;nbsp;from the client and while the service is processing the message the transport sends back an&amp;nbsp;HTTP 202, enabling the client transport to return and unblocking the&amp;nbsp;WCF client object. The WCF client object can then&amp;nbsp;make the call again. &lt;/P&gt;
&lt;P&gt;If the second call arrives while the service is still processing the first message, the&amp;nbsp;second call is blocked until the service frees up. This, in turn, prevents the HTTP 202 message from being sent back until the&amp;nbsp;dispatcher begins to process the second message. Should those&amp;nbsp;calls come in too fast, the client will begin to block.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I come up with any more, I'll let you know. Cheers, me.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=688771" width="1" height="1"&gt;</description></item><item><title>OperationContractAttribute.IsOneWay operations aren't simply fire-and-forget.</title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/08/02/686974.aspx</link><pubDate>Thu, 03 Aug 2006 00:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:686974</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=686974</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/08/02/686974.aspx#comments</comments><description>&lt;P&gt;Although I am responsible for writing a good portion of the programmer documentation for WCF, there are always little things that you "realize" suddenly that you didn't quite understand. Today, I learned&amp;nbsp;from &lt;A href="http://blogs.msdn.com/shycohen/"&gt;Shy&amp;nbsp;Cohen&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/mahjayar/default.aspx"&gt;Maheshwar Jayaraman&lt;/A&gt;&amp;nbsp;(thanks guys!)&amp;nbsp;about OperationContractAttribute.IsOneWay -- the external documentation for which is &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.isoneway.aspx"&gt;here&lt;/A&gt; and &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/ms733070.aspx"&gt;here&lt;/A&gt; and is wrong, or certainly not right &lt;STRONG&gt;&lt;EM&gt;enough&lt;/EM&gt;&lt;/STRONG&gt;. Sigh. Shall I try again?&lt;/P&gt;
&lt;P&gt;The second link typifies my misunderstanding. It says:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;A one-way operation is one in which a client invokes an operation and continues processing after WCF queues the message for sending by the client. &lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ah... not quite. What I now understand is that IsOneWay operations are really only for the case when you do not require a return message. However, the client object call does not return until the data is succesfully written to the wire -- which means that if the service cannot read the data from the wire that the client object blocks. Let me say this again: clients can block on one-way operations because the client object only returns once channel.Send() returns. &lt;/P&gt;
&lt;P&gt;For the most part, the scenario in which a client can block on a oneway call is when a client object makes a large number of one-way calls in a tight loop. For example in the following code the Print() method is a one-way operation.&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintClient client = new PrintClient();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; 3000; i++)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &amp;lt;= 300 will not block, 3000 will&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Print("String #" + i.ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Client is done");&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;In this case, the service's ability to retrieve data off the wire using the default settings is &lt;FONT face=Verdana&gt;quickly reduced; &lt;FONT size=2&gt;suddenly the client.Print call begins blocking on the return from the Send() call at the transport level. A loop like the above but with 300 or fewer calls will print out "Client is done" usally before the service can print out that it has received a message. With 3000, however, the service can print out most messages before the client is able to complete the loop.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This behavior has several ramifications that I need to put into the documentation, but I'll write them out here first.&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;One-way methods will block in any situation in which the transport cannot send the message. Fire too many one-ways at a service and it could block your client. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;It follows, then, that exceptions can be thrown on a one-way call any time Send does not return. For example, EndpointNotFoundException and SendTimeoutException can easily occur. Test it yourself! :-) &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;RM implements its own message buffer, so clients can return for a longer period -- until the RM buffer fills up, in which case the client blocks.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;More generally, the way around this problem is to insert buffers that separate the client call from the transport send action. The problem is that any such buffer will have its own limits that you must be aware of. Options include the following.&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Use asynchronous calls against the client object. (Limit: ThreadPool capacity.)&lt;/SPAN&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Use RM. (Limit: RM message buffer.)&lt;/SPAN&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;FONT face=Verdana&gt;Implement a memory message queue to call against and then make the calls from there. (Limit: queue size.)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;FONT face=Verdana&gt;In all cases, the buffer you use will still have some limit, especially to protect against denial of service attacks. The big takeaway is:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;If you want to flood out one-way messages, the &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;only way for you to get the proper client behavior in this scenario (a flood of oneway calls) is to test the kind of load you expect and balance both the client and service buffers to properly balance the load.&lt;/LI&gt;&lt;/OL&gt;&lt;/SPAN&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;FONT face=Verdana&gt;Of course, if the transport were to change and support a truer fire-and-forget model, such as UDP, you would not encounter this problem because the transport would return from Send once the data was sent regardless of the ability of the service to read the data. There it is. Now, to rewrite the documentation....&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=686974" width="1" height="1"&gt;</description></item><item><title>Extending WSDL and Policy, Part 2. Importing custom policy assertions. </title><link>http://blogs.msdn.com/b/ralph.squillace/archive/2006/07/27/681053.aspx</link><pubDate>Fri, 28 Jul 2006 05:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:681053</guid><dc:creator>ralph.squillace</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/ralph.squillace/rsscomments.aspx?WeblogPostID=681053</wfw:commentRss><comments>http://blogs.msdn.com/b/ralph.squillace/archive/2006/07/27/681053.aspx#comments</comments><description>&lt;P&gt;Yesterday I outlined how to export custom policy assertions and why you would do such a thing. One thing I failed to note explicitly, but that should be obvious, is that policy assertions are merely XML elements. At a fundamental level, that's all they are. So in addition to conveying binding-related information, they can also convey pretty much any other information as well. That's not what it's for; but still. :-)&lt;/P&gt;
&lt;P&gt;Tonight I'll discuss importing custom policy. Recall that policy assertions are to convey information about binding implementations. Therefore the point of importing policy assertions is to detect a certain policy and respond by adding a binding element, a binding, or configuring a binding or binding element to support the policy assertion. However, unlike in the service application, the importer does not need to be implemented on any particular binding element. In fact, it can be implemented on any ol' object at all. And to implement it, all you do is implement -- it should be clear -- &lt;A href="http://windowssdk.msdn.microsoft.com/en-us/library/system.servicemodel.description.ipolicyimportextension.aspx"&gt;System.ServiceModel.Description.IPolicyImportExtension&lt;/A&gt;. The external documentation fairly accurately describes the process, although I note that the example is missing (I'm here to oblige) and it looks like some text has vanished. I'll get right on that, just after I finish writing the topic on how to understand sessions, the documentation for which is currently just plain wrong in many ways.&lt;/P&gt;
&lt;P&gt;The algorithm is&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Locate the assertion you are going to respond to at the scope you are interested (binding-wide assertion, operation-wide assertion, or a message-wide assertion). 
&lt;LI&gt;Add or modify binding elements by using the BindingElements property on the PolicyConversionContext. 
&lt;LI&gt;Remove the policy assertion from the assertion collection.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;If you don't remove the assertion, the binding you were trying to modify will not be imported. All your hard import work will have been done in vain.&lt;/P&gt;
&lt;P&gt;Here's an example implementation that does NOT add a binding. We could also retrieve a binding and modify it in some way, too. Note the remove step in &lt;FONT color=#ff0000&gt;red&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;using System;&lt;BR&gt;using System.Collections.Generic;&lt;BR&gt;using System.ServiceModel;&lt;BR&gt;using System.ServiceModel.Channels;&lt;BR&gt;using System.ServiceModel.Configuration;&lt;BR&gt;using System.ServiceModel.Description;&lt;BR&gt;using System.Text;&lt;BR&gt;using System.Xml;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;namespace Microsoft.WCF.Documentation&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; public class CustomPolicyImporter : IPolicyImportExtension&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp; #region IPolicyImporter Members&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public const string name1 = "acme";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public const string ns1 = "&lt;/FONT&gt;&lt;A href="http://microsoft/WCF/Documentation/CustomPolicyAssertions"&gt;&lt;FONT face=Tahoma size=2&gt;http://Microsoft/WCF/Documentation/CustomPolicyAssertions&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma size=2&gt;";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Importing policy assertions usually means modifying the bindingelement stack in some way&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * to support the policy assertion. The procedure is:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 1. Find the custom assertion to import.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 2. Insert a supporting custom bindingelement or modify the current binding element collection&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to support the assertion.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 3. Remove the assertion from the collection. Once the ImportPolicy method has returned, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; any remaining assertions for the binding cause the binding to fail import and not be &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; constructed.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void ImportPolicy(MetadataImporter importer, PolicyConversionContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("The custom policy importer has been called.");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Locate the custom assertion.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlElement customAssertion = context.GetBindingAssertions().Find(name1, ns1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (customAssertion != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color=#ff0000&gt;context.GetBindingAssertions().Remove(customAssertion);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Removed our custom assertion from the imported "&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + "assertions collection and inserting our custom binding element."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Here we would add the binding modification that implemented the policy.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This sample does not do this.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(customAssertion.NamespaceURI + " : " + customAssertion.Name);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(customAssertion.OuterXml);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.ForegroundColor = ConsoleColor.Gray;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp; #endregion&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;Note that that this is just a class. It's not a binding element or anything special. And to wire it up in configuration, you simply do this:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;client&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address="&lt;A href="http://localhost:8080/StatefulService"&gt;http://localhost:8080/StatefulService&lt;/A&gt;" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bindingConfiguration="CustomBinding_IStatefulService" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="IStatefulService"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name="CustomBinding_IStatefulService" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;metadata&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;policyImporters&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;extension type="Microsoft.WCF.Documentation.CustomPolicyImporter, PolicyExtensions"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/policyImporters&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/metadata&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/client&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;And that's it. Tomorrow I'll move on to customizing WSDL export and import. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;Hope it helps, me.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=681053" width="1" height="1"&gt;</description></item></channel></rss>