<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/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>Ido Flatow&amp;#39;s Blog&lt;h3&gt;Veni Vidi Scripsi&lt;/h3&gt; : WCF</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx</link><description>Tags: WCF</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Wrapping up SDP Nov. 2012</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/11/29/wrapping-up-sdp-nov-2012.aspx</link><pubDate>Thu, 29 Nov 2012 09:04:27 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1494041</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1494041</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/11/29/wrapping-up-sdp-nov-2012.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/logo_77292D19.png"&gt;&lt;img title="logo" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="logo" src="http://blogs.microsoft.co.il/blogs/idof/logo_thumb_69B2F446.png" width="644" height="179" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Wow, a conference that lasts 8 days, that a first. So here’s the gist of what I taught in 5 of these days:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt; What’s new in WCF 4.5&lt;/strong&gt;      &lt;br /&gt;In this 1-hour session I covered some of the important new features of WCF 4.5, such as Intellisense for configuration, UDP and WebSockets bindings, and improved support for streaming and compression.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Debugging the Web with Fiddler       &lt;br /&gt;&lt;/strong&gt;In this 1-day tutorial we saw how to use Fiddler to debug, test, and improve Web application. We saw how to work with the session list, use various inspectors, understand the meaning of statistics and timeline, manipulate messages with replays, breakpoints, and auto responder. We also saw how to create traffic with composer and how to create custom inspectors.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Building an App with Windows 8, Windows Azure and Visual Studio 2012 &lt;/strong&gt;(with &lt;a href="http://blogs.microsoft.co.il/blogs/michaelh/"&gt;Michael Haberman&lt;/a&gt;)      &lt;br /&gt;The purpose of this 1-day tutorial was to show an end-to-end development of a distributed application that has a Windows 8 client-side, Entity Framework for database access, ASP.NET Wep API for server-side services, and hosting the entire server-side in Windows Azure (including SQL Database).      &lt;br /&gt;This tutorial day was not intended to be a deep dive into each technology, but rather show how the technologies work and fit together, and to discuss some best practices.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;HTTP Fundamentals and ASP.NET Web API&lt;/strong&gt; (with &lt;a href="http://blogs.microsoft.co.il/blogs/roadan/"&gt;Yaniv Rodenski&lt;/a&gt;)      &lt;br /&gt;You wanted a deep-dive? you got it. This 1-day tutorial, which we taught twice during the conference, covers a whole lot of HTTP and its implementation with ASP.NET Web API. We talked about the HTTP requests and responses, verbs, URIs, and mapping it to Web API routing, controllers, and actions. We talked about Web API binders, action filters, and message handlers. We talked about HTTP concepts, such as caching, streaming, compression, and persistent connections. We talked about security, IIS hosting, the HTTP.SYS listener, WebSockets, and about so much more.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All the slide decks and demo code from these days is available online at &lt;a title="http://sdrv.ms/WhqCfT" href="http://sdrv.ms/WhqCfT"&gt;http://sdrv.ms/WhqCfT&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;See you in the next SDP.&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1494041" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/SDP/default.aspx">SDP</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/fiddler/default.aspx">fiddler</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Web+API/default.aspx">Web API</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Conferences/default.aspx">Conferences</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Cloud/default.aspx">Cloud</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Windows+Azure/default.aspx">Windows Azure</category></item><item><title>Two months speaking spree</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx</link><pubDate>Fri, 05 Oct 2012 22:03:46 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1330430</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1330430</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx#comments</comments><description>&lt;p&gt;If you’ve been checking my blog in the last couple of weeks, you might have noticed I haven’t been posting much. In the past two months I have been traveling around the world, speaking in conferences and local user groups.&lt;/p&gt;  &lt;p&gt;So to sum up this intensive, fun times, here’s a list of all conferences I visited and links to all the material I showed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_thumb12_thumb_639A7B28.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image_thumb12_thumb" border="0" alt="image_thumb12_thumb" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb12_thumb_thumb_3BB77BC9.png" width="790" height="108" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;What’s new in WCF 4.5&lt;/li&gt;    &lt;li&gt;Building scalable, low-latency web apps with Windows Azure&lt;/li&gt;    &lt;li&gt;Embracing HTTP with the ASP.NET Web API&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can download the slides and code samples from &lt;a href="https://skydrive.live.com/?cid=5ef5be1ab30a6056&amp;amp;id=5EF5BE1AB30A6056%211781"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/10-5-2012-6-52-54-PM_395EBB72.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="10-5-2012 6-52-54 PM" border="0" alt="10-5-2012 6-52-54 PM" src="http://blogs.microsoft.co.il/blogs/idof/10-5-2012-6-52-54-PM_thumb_422EC3BE.png" width="604" height="123" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Debugging the web with Fiddler&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://www.web-developer-conference.de/var/ezwebin_site/storage/images/media/header/web-developer-conference/24655-6-ger-DE/Web-Developer-Conference.jpg" width="790" height="197" alt="" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Building scalable, low-latency web apps with Windows Azure&lt;/li&gt;    &lt;li&gt;Debugging the web with Fiddler&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can download the slides and code samples from &lt;a href="https://skydrive.live.com/?cid=5ef5be1ab30a6056&amp;amp;id=5EF5BE1AB30A6056%211975"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_7239153F.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_0DBE1743.png" width="604" height="154" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Embracing HTTP with the ASP.NET Web API&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://gotocon.com/dl/goto-aarhus-2012/Web/GOTO_header_forside_2012_960x175.png" width="790" height="144" alt="" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Building scalable, low-latency web apps with Windows Azure&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can download the slides and code samples from &lt;a href="https://skydrive.live.com/?cid=5ef5be1ab30a6056&amp;amp;id=5EF5BE1AB30A6056%211990"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_1B70D34B.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_4B7B24CC.png" width="604" height="198" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Building scalable, low-latency web apps with Windows Azure&lt;/li&gt;    &lt;li&gt;The new face of ASP.NET: ASP.NET MVC, Razor, and jQuery&lt;/li&gt;    &lt;li&gt;Embracing HTTP with the ASP.NET Web API&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can download the slides and code samples from &lt;a href="https://skydrive.live.com/?cid=5ef5be1ab30a6056&amp;amp;id=5EF5BE1AB30A6056%211994"&gt;here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As for future conferences, I’m going to have a couple of sessions and tutorials in the &lt;a href="http://www.sela.co.il/s/sdp2012_july/index.html"&gt;SDP&lt;/a&gt; (Sela Developer Practice) conference which will be in November in Israel. I will have a 1-hour session about the &lt;a href="http://www.sela.co.il/s/sdp2012_july/index.html#v8"&gt;new features of WCF 4.5&lt;/a&gt;, and the following three tutorial days:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.sela.co.il/s/sdp2012_july/index.html#v22"&gt;Debugging the web with Fiddler&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sela.co.il/s/sdp2012_july/index.html#v25"&gt;Building an App with Windows Phone, Windows Azure, and Visual Studio 2012&lt;/a&gt; (this tutorial will be with &lt;a href="http://beta.blogs.microsoft.co.il/blogs/michaelh/"&gt;Michael Haberman&lt;/a&gt; and &lt;a href="http://blogs.microsoft.co.il/blogs/roadan/"&gt;Yaniv Rodesnki&lt;/a&gt;)&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sela.co.il/s/sdp2012_july/index.html#v30"&gt;HTTP fundamentals and ASP.NET Web API&lt;/a&gt; (this tutorial will be with &lt;a href="http://blogs.microsoft.co.il/blogs/roadan/"&gt;Yaniv Rodesnki&lt;/a&gt;)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_5FE0EA57.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_3791B803.png" width="604" height="165" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="5"&gt;So to sum up this bunch of conferences and the &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/23/hi-my-name-is-ido-flatow-and-in-this-session-we-will-talk-about.aspx"&gt;previous one&lt;/a&gt;:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="5"&gt;1 year, 3 continents, 7 countries, 9 conferences, 24 sessions. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="5"&gt;That’s it for 2012 conferences.&lt;/font&gt;&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/10/05/two-months-speaking-spree.aspx" style="border:0px;" /&gt;&lt;/a&gt; 			  &lt;div class="addthis_toolbox addthis_default_style "&gt; &lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt; &lt;a class="addthis_button_compact"&gt;&lt;/a&gt; &lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt; &lt;/div&gt; &lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1330430" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/.NET+4/default.aspx">.NET 4</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/fiddler/default.aspx">fiddler</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Azure/default.aspx">Azure</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASP.NET+MVC+3/default.aspx">ASP.NET MVC 3</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Web+API/default.aspx">Web API</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Conferences/default.aspx">Conferences</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/.NET+4.5/default.aspx">.NET 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/2012/default.aspx">2012</category></item><item><title>WCF or ASP.NET Web APIs? My two cents on the subject</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx</link><pubDate>Mon, 05 Mar 2012 18:39:12 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1027021</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>45</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1027021</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx#comments</comments><description>&lt;p&gt;A couple of weeks ago (around Feb. 16) the WCF WebAPIs - a framework for building RESTful/Hypermedia/HTTP services, which was in development over the past 1.5 years as a side-project on &lt;a href="http://wcf.codeplex.com/"&gt;CodePlex&lt;/a&gt;, has been formally &lt;a href="http://wcf.codeplex.com/wikipage?title=WCF%20Web%20API%20is%20now%20ASP.NET%20Web%20API"&gt;integrated&lt;/a&gt; into ASP.NET and its name changed to the ASP.NET Web API.&lt;/p&gt;  &lt;p&gt;These past two weeks, there has been a lot of questions among WCF developers: What does it mean that the Web APIs are no longer a part of WCF – is WCF dead? Has SOAP gone bankrupted? is HTTP the new way to go for interoperability? &lt;/p&gt;  &lt;p&gt;To get a better understanding of what happened and what is the way to go, we need to answer a couple of questions:&lt;/p&gt;  &lt;p&gt;1. What is the purpose of the WebAPIs?&lt;/p&gt;  &lt;p&gt;2. Why do we need &lt;strike&gt;REST&lt;/strike&gt; HTTP services? What’s wrong with SOAP-over-HTTP? &lt;/p&gt;  &lt;p&gt;3. Why did the WebAPIs move from WCF to ASP.NET MVC?&lt;/p&gt;  &lt;p&gt;4. Is there still a use for WCF? When should I choose Web APIs over WCF?&lt;/p&gt;  &lt;p&gt;&lt;u&gt;What is the purpose of the WebAPIs?&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;When WCF was conceived back in its Indigo and .NET 3 days, the main goal was to support SOAP + WS-* over a wide variety of transports. However, over time it became clear that although SOAP is wide spread and supported on many platforms, it is not the only way to go when creating services. There is also a need to also support non-SOAP services, especially over HTTP, where you can harness the power of the HTTP protocol to create HTTP services: services that are activated by simple GET requests, or by passing plain XML over POST, and respond with non-SOAP content such as plain XML, a JSON string, or any other content that can be used by the consumer. Support for non-SOAP services was very much needed in WCF back then, mostly because some clients, such as web browsers, were not that suitable to handle SOAP messages (plenty of XML parsing and DOM manipulation).&lt;/p&gt;  &lt;p&gt;So in WCF 3.5 we got the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding.aspx"&gt;WebHttpBinding&lt;/a&gt; – a new binding that helped us create this kind of non-SOAP service over HTTP, better known as a RESTful service.&lt;/p&gt;  &lt;p&gt;The WebHttpBinding was not enough, and after WCF 3.5 was released, a new set of tools was created – the &lt;a href="http://msdn.microsoft.com/en-us/library/ee391967.aspx"&gt;WCF REST Starter Kit&lt;/a&gt;. The REST starter kit was an attempt to enrich the support of WCF 3.5 for HTTP services – add better client-side support for .NET apps, extend the server side support for other content types, enable response and request caching, inspection of messages and so forth. Unfortunately, this great toolkit was never officially released and ended its product cycle as “Preview 2”, although it’s still being used today in some of Microsoft’s products that are built with .NET 3.5.&lt;/p&gt;  &lt;p&gt;Although not released, some of the service-side features of the REST starter kit were &lt;a href="http://blogs.msdn.com/b/endpoint/archive/2010/01/06/introducing-wcf-webhttp-services-in-net-4.aspx"&gt;integrated into WCF 4&lt;/a&gt; – we didn’t get any of the client-side libraries, but we did get most of the service-side features (excluding the new inspectors). Some were well-integrated into WCF while others required the use of ASP.NET (by turning on the ASP.NET compatibility mode).&lt;/p&gt;  &lt;p&gt;So with WCF 4 we had some support for “Web” HTTP services, but it wasn’t that perfect – to get some of the features you needed IIS hosting and ASP.NET, not all types of requests were supported easily (ever tried posting HTML form data to a WCF HTTP service?), the overuse of CLR attributes to define the POST/GET/PUT/DELETE was tedious, not to mention the configuration required to create this type of services with all of the endpoint behavior. And even after all of that we didn’t actually get full control over the HTTP messages.&lt;/p&gt;  &lt;p&gt;That was the main goal of the Web APIs, known back then as the WCF Web APIs: to stop looking at HTTP through the eyes of WCF - as just a transport protocol to pass requests. Rather, it allows us to look at it as the real application-level protocol it is – a rich, interoperable, resource-oriented protocol. The purpose of the Web APIs was to properly use URIs, HTTP headers, and body to create HTTP services for the web, and for everyone else that wished to embrace HTTP as its protocol and lifelong friend.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Why do we need &lt;strike&gt;REST&lt;/strike&gt; HTTP services? What’s wrong with SOAP-over-HTTP? &lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The world of SOAP and the world of HTTP services are very different. SOAP allows us to place all the knowledge required by our service in the message itself, disregarding its transport protocol, whether it is TCP, HTTP, UDP, PGM, Named Pipes… But unlike TCP, UDP and the other &lt;a href="http://en.wikipedia.org/wiki/OSI_model"&gt;level 4-5&lt;/a&gt; protocols, HTTP is an application-level protocol, and as such it offers a wide variety of features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;It supports verbs that define the action - query information using GET, place new information and update existing using POST or PUT, remove information using DELETE etc. &lt;/li&gt;    &lt;li&gt;It contains message headers that are very meaningful and descriptive - headers that suggest the content type of the message’s body, headers that explain how to cache information, how to secure it etc. &lt;/li&gt;    &lt;li&gt;It contains a body that can be used for any type of content, not just XML content as SOAP enforces (and if you want something else – encode it to base64 strings and place it in the SOAP’s XML content). The body of HTTP messages can be anything you want – HTML, plain XML, JSON, binary files (images, videos, documents…) … &lt;/li&gt;    &lt;li&gt;It uses URIs for identifying both information paths (resources) and actions – the &lt;a href="http://tools.ietf.org/html/draft-gregorio-uritemplate-08"&gt;URI templates&lt;/a&gt; initiative is catching on and is rapidly becoming the standard way of representing requests for resources and &lt;a href="http://codebetter.com/glennblock/2011/05/09/hypermedia-and-forms/"&gt;hypermedia&lt;/a&gt; URIs. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The use of HTTP has evolved over the years. Application-level protocol architectural styles such as &lt;strike&gt;REST&lt;/strike&gt; &lt;a href="http://blog.steveklabnik.com/posts/2012-02-23-rest-is-over"&gt;Hypermedia APIs&lt;/a&gt; have emerged on top of HTTP. These, in turn, harness the power of HTTP to create resource-oriented services, and better define the stateless interaction between clients and services.&lt;/p&gt;  &lt;p&gt;The Web APIs therefore were intended to allow all of these approaches – you can use it to create HTTP services that only use the standard HTTP concepts (URIs and verbs), and to to create services that use more advanced HTTP features – request/response headers, hypermedia concepts etc.&lt;/p&gt;  &lt;p&gt;So HTTP is a lot more than a transport protocol. It is an application-level protocol, and the fact is that although many platforms know how to use SOAP, many more platforms know how to use HTTP! among the HTTP supporting platforms which do not support SOAP that well are the browsers – probably the most important platforms for web developers (and users). And if you don’t believe me that REST and hypermedia are useful, maybe Martin Fowler can &lt;a href="http://martinfowler.com/articles/richardsonMaturityModel.html"&gt;convince you&lt;/a&gt; better than me.&lt;/p&gt;  &lt;p&gt;This, of course, does not mean that SOAP is redundant – SOAP is still useful for building messages when you don’t have an alternative application-level protocol at your disposal, or when you want to use SOAP across the board while considering HTTP as no more than another way to pass messages (for example, use HTTP because it can cross firewalls more easily than TCP).&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Why did the WebAPIs move from WCF to ASP.NET MVC?&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Back to the story of WCF and the WCF Web APIs (we are still before the merger). Another goal of the WCF Web APIs was to incorporate known concepts that would help developers to overcome some of the drawbacks they faced with WCF, such as huge configurations, overuse of attributes, and the WCF infrastructure that did not support testing well. Thus the Web APIs used IoC, enabled convention-over-configuration, and tried to offer simpler configuration environment.&lt;/p&gt;  &lt;p&gt;The problem was that at that point in time there were several approaches for constructing HTTP services:&lt;/p&gt;  &lt;p&gt;1. WCF with the WebHttp binding and REST support.&lt;/p&gt;  &lt;p&gt;2. The new WCF Web APIs, soon to be ASP.NET Web APIs.&lt;/p&gt;  &lt;p&gt;3. A not-so-new framework, ASP.NET MVC, which took a break from being HTML-oriented (getting requests from HTML pages and returning HTML/JSON) to being &lt;a href="http://iwantmymvc.com/rest-service-mvc3"&gt;Resource-oriented&lt;/a&gt; – people started realizing that they can consider controllers as services and use the MVC infrastructure to define the control requests, responses, and better control the HTTP message.&lt;/p&gt;  &lt;p&gt;4. Open source frameworks such as &lt;a href="http://serialseb.blogspot.com/2008/12/openrasta-is-available.html"&gt;OpenRasta&lt;/a&gt; and &lt;a href="https://github.com/ServiceStack/ServiceStack"&gt;ServiceStack&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In addition to that, as time passed, the WCF Web APIs had a lot of trouble adapting WCF to the “native” HTTP world. As WCF was primarily designed for SOAP-based XML messages, and the “open-heart” surgery that was required to make the Web API work as part of WCF was a bit too much (or so I understand from people who were involved in creating the Web APIs). On the other hand, the ASP.NET MVC infrastructure with its elegant handling of HTTP requests and responses, and its support of easy-to-create controllers seemed like the proper way to go for creating this new type of services.&lt;/p&gt;  &lt;p&gt;So the fact was we had too many options and therefore too much confusion. What were we to do? We merge teams! (Kind of reminds us of the time of LINQ-to-SQL and Entity Framework, WCF and Ado.Net Data Services and other such examples). So the WCF team and the ASP.NET team joined forces and created a new framework focused on the world of REST/Hypermedia/HTTP services for the web world and thus came out the ASP.NET Web APIs.&lt;/p&gt;  &lt;p&gt;I’m still not so sure about the choice of names, as the new Web APIs can also work outside of ASP.NET with the use of WCF, but I guess that the name “WCF ASP.NET Web API” was a bit long. Maybe “WASP Web API”? “WAWAPI” (Wcf Aspnet Web API)? Or maybe simply call it “Hypermedia Web API”?&lt;/p&gt;  &lt;p&gt;So this merger is intended to reduce confusion, not induce it. I guess that if it was explained at that time, it might have caused less confusion over time (see the &lt;a href="http://blogs.msdn.com/b/silverlight/archive/2010/11/01/pdc-and-silverlight.aspx"&gt;Silverlight is dead&lt;/a&gt; slip of PDC 2010). Does Microsoft need a new DevDiv PR team?&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Is there still use for WCF? when should I choose Web APIs over WCF?&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Recall my points from before - HTTP is a lot more than a transport protocol; use SOAP across the board and consider HTTP as no more than another way to pass messages.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If your intention is to create services that support special scenarios – one way messaging, message queues, duplex communication etc, then you’re better of picking WCF &lt;/li&gt;    &lt;li&gt;If you want to create services that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transports are unavailable, then you’re better off with WCF and using both SOAP-based bindings and the WebHttp binding. &lt;/li&gt;    &lt;li&gt;If you want to create resource-oriented services over HTTP that can use the full features of HTTP – define cache control for browsers, versioning and concurrency using ETags, pass various content types such as images, documents, HTML pages etc., use URI templates to include Task URIs in your responses, then the new Web APIs are the best choice for you. &lt;/li&gt;    &lt;li&gt;If you want to create a multi-target service that can be used as both resource-oriented service over HTTP and as RPC-style SOAP service over TCP – talk to me first, so I’ll give you some pointers. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I hope this helped you removing some of the confusion over this topic.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx" style="border:0px;" /&gt;&lt;/a&gt; 			  &lt;div class="addthis_toolbox addthis_default_style "&gt; &lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt; &lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt; &lt;a class="addthis_button_compact"&gt;&lt;/a&gt; &lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt; &lt;/div&gt; &lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt; &lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1027021" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/REST/default.aspx">REST</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Hypermedia/default.aspx">Hypermedia</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Web+API/default.aspx">Web API</category></item><item><title>What’s new in WCF 4.5? WebSocket support (Part 1 of 2)</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx</link><pubDate>Thu, 01 Mar 2012 21:12:43 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1023699</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>317</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1023699</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx#comments</comments><description>&lt;p&gt;This is the 11th post in the WCF 4.5 series. The previous post was about the new UDP transport support, and this new post is also about new transports – the WebSocket transport.&lt;/p&gt;  &lt;p&gt;This post is part 1 of 2. This post will be about the WebSocket support between .NET apps using WCF (SOAP-based), and the next post will be about using WebSockets between browsers and WCF (non-SOAP).&lt;/p&gt;  &lt;p&gt;Previous posts:&lt;/p&gt;  &lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;What’s new in WCF 4.5? a single WSDL file&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/19/what-s-new-in-wcf-4-5-configuration-tooltips-and-intellisense-in-config-files.aspx"&gt;What’s new in WCF 4.5? Configuration tooltips and intellisense in config files&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-configuration-validations.aspx"&gt;What’s new in WCF 4.5? Configuration validations&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-multiple-authentication-support-on-a-single-endpoint-in-iis.aspx"&gt;What’s new in WCF 4.5? Multiple authentication support on a single endpoint in IIS&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;6. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/05/what-s-new-in-wcf-4-5-automatic-https-endpoint-for-iis.aspx"&gt;What’s new in WCF 4.5? Automatic HTTPS endpoint for IIS&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;7. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/10/what-s-new-in-wcf-4-5-basichttpsbinding.aspx"&gt;What’s new in WCF 4.5? BasicHttpsBinding&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;8. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/31/what-s-new-in-wcf-4-5-changed-default-for-asp-net-compatibility-mode.aspx"&gt;What’s new in WCF 4.5? Changed default for ASP.NET compatibility mode&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;9. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx"&gt;What’s new in WCF 4.5? Improved streaming in IIS hosting&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;10. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx"&gt;What’s new in WCF 4.5? UDP transport support&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;A (very) short introduction to WebSockets&lt;/strong&gt; – WebSocket is a bi-directional (two-way), full-duplex channel. WebSocket channels start as normal HTTP channels, and then use handshakes to upgrade the channel to WebSocket, allowing two-way TCP communication between client and server, thus overcoming several limitations enforced by firewalls. In order not to repeat all that is already written about WebSockets, I suggest you check the following websites:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/WebSocket"&gt;http://en.wikipedia.org/wiki/WebSocket&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://websocket.org/"&gt;http://websocket.org/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://datatracker.ietf.org/doc/rfc6455/"&gt;https://datatracker.ietf.org/doc/rfc6455/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note: This post was written according to the WebSocket support of WCF 4.5 with .NET 4.5 Beta and Visual Studio 11 Beta. If you are still using the Developer Preview version, you might see some different configuration sections and different behavior of the “Add Service Reference” feature.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The support of WebSocket in WCF 4.5 is achieved through the new NetHttpBinding. The NetHttpBinding was first introduced in the &lt;a href="http://msdn.microsoft.com/en-us/library/aa395198.aspx"&gt;WCF 4 samples&lt;/a&gt; as a custom binding that uses binary-encoded SOAP messages over HTTP(S). The NetHttpBinding in WCF 4.5 is an improved binding that uses binary-encoded SOAP messages over HTTP(S) or WebSocket transports. The NetHttpBinding can be used in any of the following ways:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Request-Response over HTTP.&lt;/strong&gt; This mode does not use WebSockets, but rather a simple HTTP/HTTPS channel with binary-encoded SOAP messages.       &lt;br /&gt;This mode is the default mode when using the binding without a duplex contract. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Duplex over WebSocket&lt;/strong&gt;. This mode uses WebSockets, and allows two-way communication between client and service.       &lt;br /&gt;This mode is automatically used when you declare your service contract with a callback contract (duplex). &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Request-Response over WebSocket&lt;/strong&gt;. This mode uses WebSockets, but it does not take advantage of the two-way communication support of the channel (since we still use the request-response pattern).       &lt;br /&gt;This mode is used when doing one of the following:       &lt;ol&gt;       &lt;li&gt;Changing the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.sessionmode.aspx"&gt;SessionMode&lt;/a&gt; of the contract to &lt;strong&gt;Required&lt;/strong&gt;. The binding will upgrade automatically from HTTP to WebSocket, since HTTP is not sessionful and WebSocket is. &lt;/li&gt;        &lt;li&gt;Manually forcing WebSocket by changing the binding configuration and setting the WebSocket transport usage to &lt;strong&gt;Always&lt;/strong&gt;. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Since &lt;strong&gt;WebSocket is sessionful&lt;/strong&gt;, you automatically get &lt;strong&gt;session support&lt;/strong&gt; in your service, if you haven’t changed the instance context mode from the default PerSession setting. If you’ve ever needed a sessionful HTTP channel and had to use WsHttpBinding with WS-ReliableMessaging, you now have another option which doesn’t require passing extra WS-RM messages.&lt;/p&gt;  &lt;p&gt;NetHttpBinding with WebSocket can in fact replace the use of WsDualHttpBinding, since WebSocket provides a duplex channel which also supports sessions – this is better than WsDualHttpBinding which uses two channels, and require the use of WS-ReliableMessaging for session management.&lt;/p&gt;  &lt;p&gt;All three modes of the binding are non-interoperable, because they use binary-encoded SOAP messages which is a proprietary Microsoft encoding technique. If you want to learn more about binary encoding, I suggest you read Nicholas Allen’s &lt;a href="http://bitly.com/bundles/idof/3"&gt;posts&lt;/a&gt; on the subject. However, this does not mean we cannot use WebSockets as an interoperable transport with text-based SOAP messages – we can change the binding configuration to use text instead of binary, thus making in interoperable, as shown later on.&lt;/p&gt;  &lt;p&gt;To demonstrate the usage of NetHttpBinding, I’ve created a simple duplex contract:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;[ServiceContract(CallbackContract=&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(IDuplexCallbackContract))]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IDuplexContract
{
    [OperationContract]
    &lt;span class="kwrd"&gt;string&lt;/span&gt; SayHelloDuplex(&lt;span class="kwrd"&gt;string&lt;/span&gt; name);
}

[ServiceContract]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IDuplexCallbackContract
{
    [OperationContract]
    &lt;span class="kwrd"&gt;void&lt;/span&gt; SayingHello(&lt;span class="kwrd"&gt;string&lt;/span&gt; message);
}&lt;/pre&gt;
And a service that implements the contract: 

&lt;pre class="csharpcode"&gt;[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WebSocketSampleService : IRegularContract, IDuplexContract
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; SayHelloDuplex(&lt;span class="kwrd"&gt;string&lt;/span&gt; name)
    {
        OperationContext.Current.
            GetCallbackChannel&amp;lt;IDuplexCallbackContract&amp;gt;().
            SayingHello(&lt;span class="str"&gt;&amp;quot;Hello &amp;quot;&lt;/span&gt; + name + &lt;span class="str"&gt;&amp;quot; by WebSockets&amp;quot;&lt;/span&gt;);

        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;Hello &amp;quot;&lt;/span&gt; + name;
    }
}&lt;/pre&gt;

&lt;p&gt;The endpoint configuration is quite simple:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://localhost:8083&amp;quot;&lt;/span&gt;
          &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;netHttpBinding&amp;quot;&lt;/span&gt;
          &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Contracts.IDuplexContract&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;It appear that the WCF Service Configuration Editor doesn’t recognize the NetHttpBinding’s WebSocket configuration, so you’ll need to use Visual Studio’s XML editor (the binding configuration is supported from VS11 Beta).&lt;/p&gt;

&lt;p&gt;And as for the client-side code, just add a service reference and call the service:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Services.IDuplexContract duplexProxy;
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press enter when service is ready&amp;quot;&lt;/span&gt;);
Console.ReadLine();

&lt;span class="rem"&gt;// Use the generated proxy class&lt;/span&gt;
duplexProxy = &lt;span class="kwrd"&gt;new&lt;/span&gt; Services.DuplexContractClient(
    callbackContext,
    &lt;span class="str"&gt;&amp;quot;DuplexContract&amp;quot;&lt;/span&gt;);
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Calling the duplex contract:&amp;quot;&lt;/span&gt;);
Console.WriteLine(duplexProxy.SayHelloDuplex(&lt;span class="str"&gt;&amp;quot;ido&amp;quot;&lt;/span&gt;));

&lt;span class="rem"&gt;// Or use a DuplexChannelFactory&lt;/span&gt;
DuplexChannelFactory&amp;lt;Services.IDuplexContract&amp;gt; dchf =
    &lt;span class="kwrd"&gt;new&lt;/span&gt; DuplexChannelFactory&amp;lt;Services.IDuplexContract&amp;gt;(
        callbackContext,
        &lt;span class="kwrd"&gt;new&lt;/span&gt; NetHttpBinding(),&lt;br /&gt;        &lt;span class="kwrd"&gt;new&lt;/span&gt; EndpointAddress(&lt;span class="str"&gt;&amp;quot;http://localhost:8083/&amp;quot;&lt;/span&gt;));
duplexProxy = dchf.CreateChannel();
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Calling the duplex contract using text encoded messages:&amp;quot;&lt;/span&gt;);
Console.WriteLine(duplexProxy.SayHelloDuplex(&lt;span class="str"&gt;&amp;quot;ido&amp;quot;&lt;/span&gt;));&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: When specifying the endpoint address in the service, you need to use the http:// scheme, but on the client-side you can use either http:// or ws://. When generating a service reference, the client configuration will use the ws:// scheme.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If your service endpoint uses NetHttpBinding but you contract is a non-duplex service contract (without a callback contract), you can still use NetHttpBinding, but the channel will be HTTP and not WebSockets – in this case the generated client configuration will create a custom binding instead of NetHttpBinding. The custom binding is a perfect match of the NetHttpBinding so things will still work, but it may be a bit confusing the first time you see it. I hope this will be resolved in the RTM version of VS 11. &lt;/p&gt;

&lt;p&gt;When you add a service reference to the service, the client side configuration will be generated with a custom binding instead of the NetHttpBinding - you can either leave it as-is, or remove the custom binding and rewrite the configuration to use the NetHttpBinding (of course you might need to do it again when you update the service reference).&lt;/p&gt;

&lt;p&gt;It is also quite easy to define a new service endpoint which uses the NetHttpBinding with text-based SOAP messages instead of binary:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Host.WebSocketSampleService&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://localhost:8084&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;netHttpBinding&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;bindingConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TextOverWebSockets&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Contracts.IDuplexContract&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;netHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TextOverWebSockets&amp;quot; &lt;span class="attr"&gt;messageEncoding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Text&amp;quot;&lt;/span&gt;/&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;netHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;So as you can see, we have the ability to use both binary and text, but how can we be sure it actually passes text instead of binary? for that we need a network sniffer that can show us the WebSocket messages. You can use Wireshark or any other TCP sniffer to check that, however I always found those sniffers to be a bit hard to manage, especially for localhost communication. Luckily for us, we can use Fiddler, the famous HTTP sniffer, which now supports WebSocket messages (although &lt;a href="http://blogs.msdn.com/b/fiddler/archive/2011/11/22/fiddler-and-websockets.aspx"&gt;only for watching&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;This is how the binary message looks like when sent over WebSockets:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_122B477B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_01569F29.png" width="604" height="400" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is how the text message looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_100534DE.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_1426E4A5.png" width="604" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is the HTTP connection upgrade request:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_44E53C77.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_53C85792.png" width="604" height="535" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(notice the GET request for WebSocket upgrade, and the corresponding HTTP 101 – Switching Protocols response)&lt;/p&gt;

&lt;p&gt;If you want to use WebSockets for a simple Request-Response contract, you can also do that, but you’ll need to set the binding configuration of your endpoint to require WebSocket communication:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;netHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ReqResWithWebSockets&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
             &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;webSocketSettings&lt;/span&gt; &lt;font color="#ff0000"&gt;transportUsage&lt;/font&gt;&lt;span class="kwrd"&gt;=&amp;quot;Always&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;netHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;      
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;You can download the sample code from my &lt;a href="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!481&amp;amp;parid=5EF5BE1AB30A6056!129"&gt;SkyDrive&lt;/a&gt; which demonstrates all of the above including duplex, request-response, sessions, forcing WebSockets, and text encoded messages.&lt;/p&gt;

&lt;p&gt;When considering the use of WebSocket via NetHttpBinding for duplex communication vs. WsDualHttpBinding and NetTcpBinding, the benefits of NetHttpBindings are:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Like NetTcp it requires one channel instead of two, as in the case of WsDualHttp. &lt;/li&gt;

  &lt;li&gt;Like NetTcp it has a sessionful channel, unlike WsDualHttp which requires the use of WS-ReliableMessaging. &lt;/li&gt;

  &lt;li&gt;Like NetTcp, it uses binary encoding which reduces the message size, unlike the text encoding of WsDualHttp. &lt;/li&gt;

  &lt;li&gt;Unlike NetTcp, it can &lt;a href="http://www.infoq.com/articles/Web-Sockets-Proxy-Servers"&gt;overcome&lt;/a&gt; some firewall restrictions that prohibit TCP communication. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As we’ve seen so far, the WebSocket support in WCF 4.5 uses SOAP-based messages. In the next post I will cover how to use WebSockets in WCF 4.5 to communicate with non-SOAP clients, such as web browsers, using simple text over WebSockets.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx" style="border:0px;" /&gt;&lt;/a&gt; 			

&lt;div class="addthis_toolbox addthis_default_style "&gt;
&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;
&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;
&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;
&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;
&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;
&lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt;
&lt;a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag" style="display:none;"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1023699" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/fiddler/default.aspx">fiddler</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/websocket/default.aspx">websocket</category></item><item><title>What’s new in WCF 4.5? UDP transport support</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx</link><pubDate>Thu, 16 Feb 2012 03:50:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1014306</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1014306</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx#comments</comments><description>&lt;p&gt;This is the tenth post in the WCF 4.5 series. I’ve started this series of posts 4 months ago when &lt;a href="http://msdn.microsoft.com/en-us/netframework/hh403373"&gt;.NET 4.5 developer preview&lt;/a&gt; was announced; The Beta/RC/RTM version is still to come, but hopefully it will be available soon, and you will be able to use the new WCF 4.5 features in your projects.&lt;/p&gt;
&lt;p&gt;Until now, I’ve shown new features in configuration easiness and hosting improvements. In this post and the next one I will cover new transport features, starting with the support for the UDP transport.&lt;/p&gt;
&lt;p&gt;Previous posts:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;What’s new in WCF 4.5? a single WSDL file&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/19/what-s-new-in-wcf-4-5-configuration-tooltips-and-intellisense-in-config-files.aspx"&gt;What’s new in WCF 4.5? Configuration tooltips and intellisense in config files&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-configuration-validations.aspx"&gt;What’s new in WCF 4.5? Configuration validations&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-multiple-authentication-support-on-a-single-endpoint-in-iis.aspx"&gt;What’s new in WCF 4.5? Multiple authentication support on a single endpoint in IIS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;6. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/05/what-s-new-in-wcf-4-5-automatic-https-endpoint-for-iis.aspx"&gt;What’s new in WCF 4.5? Automatic HTTPS endpoint for IIS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;7. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/10/what-s-new-in-wcf-4-5-basichttpsbinding.aspx"&gt;What’s new in WCF 4.5? BasicHttpsBinding&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;8. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/31/what-s-new-in-wcf-4-5-changed-default-for-asp-net-compatibility-mode.aspx"&gt;What’s new in WCF 4.5? Changed default for ASP.NET compatibility mode&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;9. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx"&gt;What’s new in WCF 4.5? Improved streaming in IIS hosting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I’ve been teaching WCF for several years now, and almost every time I explain to people about the different types of bindings and supported transports someone asks me if there is a built-in support for a UDP transport. Until now my answer was “It isn’t supported out-of-the-box, but there is a &lt;a href="http://msdn.microsoft.com/en-us/library/ms751494.aspx"&gt;UDP transport sample&lt;/a&gt; in the &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=21459"&gt;WCF/WF samples&lt;/a&gt;”. From now on my new answer is “In WCF 4/3.5 there is a sample implementation, but it is now out-of-the-box in WCF 4.5”.&lt;/p&gt;
&lt;p&gt;You can get some basic info about the binding in the &lt;a href="http://msdn.microsoft.com/en-us/library/ms730879(v=vs.110).aspx"&gt;System-Provided Bindings&lt;/a&gt; page on MSDN (make sure you look at the 4.5 version), unfortunately there is no documentation on the UdpBinding type yet, but hopefully MS will create it by the time WCF 4.5 is released.&lt;/p&gt;
&lt;p&gt;Declaring an endpoint that uses UDP is quite simple:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;soap.udp://localhost:8080/&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;udpBinding&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;UdpHost.IService&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Some facts about the new UDP binding:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The address scheme for this binding is &lt;strong&gt;soap.udp://&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;The binding is supported only&amp;nbsp;by .NET (since it does uses text encoding for the SOAP messages, it can be considered interoperable, although currently no other SOAP-based services technology support UDP)&lt;/li&gt;
&lt;li&gt;Security is not supported (neither transport or message) &lt;/li&gt;
&lt;li&gt;Sessions, transactions, streaming, and duplex are not supported (I was hoping for a duplex UDP using one-way messages) &lt;/li&gt;
&lt;li&gt;Supported encoding is text &lt;/li&gt;
&lt;li&gt;The binding can be used in code by adding a reference to the System.ServiceModel.Channels assembly &lt;/li&gt;
&lt;li&gt;The binding is not supported in IIS/WAS, since there is still no UDP shared listener for WAS&lt;/li&gt;
&lt;li&gt;In the case of One-Way messages, this is a true one-way unidirectional call - the client won’t throw an exception if the service is unavailable &lt;/li&gt;
&lt;li&gt;If you specify a &lt;a href="http://en.wikipedia.org/wiki/Multicast_address"&gt;multicast address&lt;/a&gt; in the endpoint, such as 224.0.0.1 or 239.255.255.255 (the later is used by UDP discovery endpoints), you can create multiple listeners on the same address+protocol even from different machines – one client can send a single message that will be received by multiple listeners – this can be a great way to synchronize server state, do pub-sub (notification) calls etc...&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Using a multicast listening address is also quite simple:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;soap.udp://239.255.255.255:8083/&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;udpBinding&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;UdpHost.IService&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;As for performance, I’ve create a simple client which sends 5000 messages using request-response and one-way (simple and multicast), with HTTP (basicHttp), TCP, and UDP bindings. For the purpose of the test I’ve removed all security settings from the NetTcp binding. The result is shown below:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using UDP &lt;br /&gt;One-way using UDP took 0 seconds, average is 0.1792ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using HTTP &lt;br /&gt;One-way using HTTP took 6 seconds, average is 1.3ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using TCP &lt;br /&gt;One-way using TCP took 2 seconds, average is 0.5876ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using UDP Multicast &lt;br /&gt;One-way using UDP Multicast took 3 seconds, average is 0.736ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using UDP &lt;br /&gt;Request-response using UDP took 7 seconds, average is 1.4738ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using HTTP &lt;br /&gt;Request-response using HTTP took 8 seconds, average is 1.7784ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using TCP &lt;br /&gt;Request-response using TCP took 4 seconds, average is 0.9518ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Conclusions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;One-way messages are fast when using UDP – about 7 times faster than HTTP, and 3 times faster than TCP. I assume this is because when using UDP we don’t need to wait for the TCP &lt;a href="http://en.wikipedia.org/wiki/Acknowledgement_(data_networks)"&gt;ACK&lt;/a&gt; (also used in HTTP).&lt;/li&gt;
&lt;li&gt;One-way multicast messages in UDP are slower than direct messages – about 4 times slower&lt;/li&gt;
&lt;li&gt;Request-response message in UDP are slower than TCP, but faster than HTTP. I assume the reason for being slower than TCP is that UDP uses two channels to create request-response whereas TCP requires only one channel.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Trying to run the same sample when the server has not been started produces the following results:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using UDP &lt;br /&gt;One-way using UDP took 0 seconds, average is 0.1216ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using HTTP &lt;br /&gt;One-way using HTTP failed&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using TCP &lt;br /&gt;One-way using TCP failed&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations one way using UDP Multicast &lt;br /&gt;One-way using UDP Multicast took 1 seconds, average is 0.376ms&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using UDP &lt;br /&gt;Request-response using UDP failed&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using HTTP &lt;br /&gt;Request-response using HTTP failed&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Calling 5000 iterations of request-response using TCP &lt;br /&gt;Request-response using TCP failed&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As you can see, UDP one-way messages are unidirectional!!!&lt;/p&gt;
&lt;p&gt;The sample code is available on my &lt;a href="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!467&amp;amp;parid=5EF5BE1AB30A6056!129"&gt;SkyDrive&lt;/a&gt;.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/15/what-s-new-in-wcf-4-5-udp-transport-support.aspx" /&gt;&lt;/a&gt; 
&lt;div class="addthis_toolbox addthis_default_style "&gt;&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;&lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt;
&lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1014306" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/UDP/default.aspx">UDP</category></item><item><title>Calling a WCF service from a client without having the contract interface</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx</link><pubDate>Fri, 10 Feb 2012 05:47:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1010779</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>32</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1010779</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx#comments</comments><description>&lt;p&gt;I was asked yesterday in the Hebrew C#/.NET Framework MSDN forums a &lt;a href="http://social.msdn.microsoft.com/Forums/he-IL/nethe/thread/1678e16f-877c-44c9-9ccf-9b9c39bc51b4"&gt;tough question&lt;/a&gt; – is it possible to dynamically call a WCF service using only the contract name, operation name, and metadata address?&lt;/p&gt;
&lt;p&gt;At first I agreed with the answer given in the forum – move from SOAP bindings to WebHttpBinding (“REST”). This of course makes things a lot easier, only requiring you to create a WebHttpRequest and parse the response. However the question remains - is it possible to do this in the case of a SOAP-based service endpoint? &lt;/p&gt;
&lt;p&gt;The short answer is – YES! &lt;/p&gt;
&lt;p&gt;The full answer is – YES, but you’ll need to do a lot of coding to make it work properly, and even more coding for complex scenarios (who said passing a data contract?)&lt;/p&gt;
&lt;p&gt;How is it done you ask?&lt;/p&gt;
&lt;p&gt;First let’s start with the contract – you have a simple contract that looks like so:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;[ServiceContract]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ICalculator&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;  [OperationContract]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;  &lt;span class="kwrd"&gt;double&lt;/span&gt; Add(&lt;span class="kwrd"&gt;double&lt;/span&gt; n1, &lt;span class="kwrd"&gt;double&lt;/span&gt; n2);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;  [OperationContract]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;  &lt;span class="kwrd"&gt;double&lt;/span&gt; Subtract(&lt;span class="kwrd"&gt;double&lt;/span&gt; n1, &lt;span class="kwrd"&gt;double&lt;/span&gt; n2);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  [OperationContract]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;  &lt;span class="kwrd"&gt;double&lt;/span&gt; Multiply(&lt;span class="kwrd"&gt;double&lt;/span&gt; n1, &lt;span class="kwrd"&gt;double&lt;/span&gt; n2);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;  [OperationContract]&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;  &lt;span class="kwrd"&gt;double&lt;/span&gt; Divide(&lt;span class="kwrd"&gt;double&lt;/span&gt; n1, &lt;span class="kwrd"&gt;double&lt;/span&gt; n2);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At this point the implementation doesn’t matter, but you can assume the service compiles and loads successfully.&lt;/p&gt;
&lt;p&gt;Second, make sure your service has either a MEX endpoint or metadata exposed over HTTP GET. Read &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;here&lt;/a&gt; for more info about the difference between the two.&lt;/p&gt;
&lt;p&gt;Third – do the client coding!!! to create the client code I took some ideas from the following links:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/ms733780.aspx" href="http://msdn.microsoft.com/en-us/library/ms733780.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms733780.aspx&lt;/a&gt; – generating client-side type information for WCF contracts &lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.codeproject.com/Articles/42278/Call-a-Web-Service-Without-Adding-a-Web-Reference" href="http://www.codeproject.com/Articles/42278/Call-a-Web-Service-Without-Adding-a-Web-Reference"&gt;http://www.codeproject.com/Articles/42278/Call-a-Web-Service-Without-Adding-a-Web-Reference&lt;/a&gt; – the same concept of dynamic calls, but for ASP.NET web services (ASMX).&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Description;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Globalization;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.ObjectModel;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.CodeDom.Compiler;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Client&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            &lt;span class="rem"&gt;// Define the metadata address, contract name, operation name, and parameters. &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="rem"&gt;// You can choose between MEX endpoint and HTTP GET by changing the address and enum value.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            Uri mexAddress = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;http://localhost:8732/CalculatorService/?wsdl&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            &lt;span class="rem"&gt;// For MEX endpoints use a MEX address and a mexMode of .MetadataExchange&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            MetadataExchangeClientMode mexMode = MetadataExchangeClientMode.HttpGet;            &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; contractName = &lt;span class="str"&gt;&amp;quot;ICalculator&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; operationName = &lt;span class="str"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            &lt;span class="kwrd"&gt;object&lt;/span&gt;[] operationParameters = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { 1, 2 };&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            &lt;span class="rem"&gt;// Get the metadata file from the service.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            MetadataExchangeClient mexClient = &lt;span class="kwrd"&gt;new&lt;/span&gt; MetadataExchangeClient(mexAddress, mexMode);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            mexClient.ResolveMetadataReferences = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            MetadataSet metaSet = mexClient.GetMetadata();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;            &lt;span class="rem"&gt;// Import all contracts and endpoints&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            WsdlImporter importer = &lt;span class="kwrd"&gt;new&lt;/span&gt; WsdlImporter(metaSet);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            Collection&amp;lt;ContractDescription&amp;gt; contracts = importer.ImportAllContracts();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            ServiceEndpointCollection allEndpoints = importer.ImportAllEndpoints();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            &lt;span class="rem"&gt;// Generate type information for each contract&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            ServiceContractGenerator generator = &lt;span class="kwrd"&gt;new&lt;/span&gt; ServiceContractGenerator();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;            var endpointsForContracts = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, IEnumerable&amp;lt;ServiceEndpoint&amp;gt;&amp;gt;();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ContractDescription contract &lt;span class="kwrd"&gt;in&lt;/span&gt; contracts)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                generator.GenerateServiceContractType(contract);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;                &lt;span class="rem"&gt;// Keep a list of each contract&amp;#39;s endpoints&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;                endpointsForContracts[contract.Name] = allEndpoints.Where(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;                    se =&amp;gt; se.Contract.Name == contract.Name).ToList();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (generator.Errors.Count != 0)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;                &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(&lt;span class="str"&gt;&amp;quot;There were errors during code compilation.&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            &lt;span class="rem"&gt;// Generate a code file for the contracts &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;            CodeGeneratorOptions options = &lt;span class="kwrd"&gt;new&lt;/span&gt; CodeGeneratorOptions();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;            options.BracingStyle = &lt;span class="str"&gt;&amp;quot;C&amp;quot;&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;            CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider(&lt;span class="str"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;            &lt;span class="rem"&gt;// Compile the code file to an in-memory assembly&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;            &lt;span class="rem"&gt;// Don&amp;#39;t forget to add all WCF-related assemblies as references&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;            CompilerParameters compilerParameters = &lt;span class="kwrd"&gt;new&lt;/span&gt; CompilerParameters(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;                &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] { &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;                    &lt;span class="str"&gt;&amp;quot;System.dll&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;System.ServiceModel.dll&amp;quot;&lt;/span&gt;, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;                    &lt;span class="str"&gt;&amp;quot;System.Runtime.Serialization.dll&amp;quot;&lt;/span&gt; });&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;            compilerParameters.GenerateInMemory = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;            CompilerResults results = codeDomProvider.CompileAssemblyFromDom(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;                compilerParameters, generator.TargetCompileUnit);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (results.Errors.Count &amp;gt; 0)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;                &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(&lt;span class="str"&gt;&amp;quot;There were errors during generated code compilation&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;                &lt;span class="rem"&gt;// Find the proxy type that was generated for the specified contract&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;                &lt;span class="rem"&gt;// (identified by a class that implements the contract and ICommunicationbject)&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;                Type clientProxyType = results.CompiledAssembly.GetTypes().First(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;                    t =&amp;gt; t.IsClass &amp;amp;&amp;amp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;                        t.GetInterface(contractName) != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;                        t.GetInterface(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(ICommunicationObject).Name) != &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;                        &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;                &lt;span class="rem"&gt;// Get the first service endpoint for the contract&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;                ServiceEndpoint se = endpointsForContracts[contractName].First();                    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;                &lt;span class="rem"&gt;// Create an instance of the proxy&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;                &lt;span class="rem"&gt;// Pass the endpoint&amp;#39;s binding and address as parameters&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;                &lt;span class="rem"&gt;// to the ctor&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;                &lt;span class="kwrd"&gt;object&lt;/span&gt; instance = results.CompiledAssembly.CreateInstance(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;                    clientProxyType.Name, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;false&lt;/span&gt;, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;                    System.Reflection.BindingFlags.CreateInstance, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;null&lt;/span&gt;,&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { se.Binding, se.Address }, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;                    CultureInfo.CurrentCulture, &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;                &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;                &lt;span class="rem"&gt;// Get the operation&amp;#39;s method, invoke it, and get the return value&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;                &lt;span class="kwrd"&gt;object&lt;/span&gt; retVal = instance.GetType().GetMethod(operationName).&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;                    Invoke(instance, operationParameters);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  97:  &lt;/span&gt;                Console.WriteLine(retVal.ToString());&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  98:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  99:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 100:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 101:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I’ve placed comments that describe the code, but basically it imports the WSDL, generates types for the contract (service + data), generates C# code from it, compiles it, and uses reflection to create a proxy and invoke the correct method.&lt;/p&gt;
&lt;p&gt;If you want to use this technique to call methods that require a data contract, you will need some extra work to create the correct type and initialize it.&lt;/p&gt;
&lt;p&gt;A compiled and running version of this code (+ the service) can be found here: &lt;a title="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!466&amp;amp;parid=5EF5BE1AB30A6056!129" href="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!466&amp;amp;parid=5EF5BE1AB30A6056!129"&gt;https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!466&amp;amp;parid=5EF5BE1AB30A6056!129&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hope you find this piece of code useful.&lt;/p&gt;
&lt;p&gt;Feb-12:&lt;/p&gt;
&lt;p&gt;Just found out this great blog post that uses the same implementation only to enable calling WCF services from PowerShell.&amp;nbsp; &lt;br /&gt;&lt;a title="http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/" href="http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/"&gt;http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/&lt;/a&gt;&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/02/10/calling-a-wcf-service-from-a-client-without-having-the-contract-interface.aspx" /&gt;&lt;/a&gt; 
&lt;div class="addthis_toolbox addthis_default_style "&gt;&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;&lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt;
&lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1010779" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/CodeDom/default.aspx">CodeDom</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/mex/default.aspx">mex</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WsdlImporter/default.aspx">WsdlImporter</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+Client/default.aspx">WCF Client</category></item><item><title>WCF/ASMX Interoperability – Removing the Annoying xxxSpecified when Adding a Web Reference to a WCF Service</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx</link><pubDate>Wed, 01 Feb 2012 01:22:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:1003550</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=1003550</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx#comments</comments><description>&lt;p&gt;Today I answered a &lt;a href="http://social.msdn.microsoft.com/Forums/he-IL/nethe/thread/53c28854-d853-4713-a389-132a28dd0297"&gt;question&lt;/a&gt; in the Hebrew MSDN forums about consuming WCF from a .NET 2 client, using the “Add Web Reference” option of Visual Studio.&lt;/p&gt;
&lt;p&gt;Just in case you don’t know Hebrew I’ll sum it up for you – when adding a web reference to a WCF service that exposes a method of the following sort:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt; UseScalarTypes(&lt;span class="kwrd"&gt;int&lt;/span&gt; value1, &lt;span class="kwrd"&gt;int&lt;/span&gt; value2)&lt;/pre&gt;
&lt;p&gt;The generated method signature in the client app will look like so:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; UseScalarTypes(
  &lt;span class="kwrd"&gt;int&lt;/span&gt; value1, &lt;span class="kwrd"&gt;bool&lt;/span&gt; value1Specified, 
  &lt;span class="kwrd"&gt;int&lt;/span&gt; value2, &lt;span class="kwrd"&gt;bool&lt;/span&gt; value2Specified, 
  &lt;span class="kwrd"&gt;out&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; UseScalarTypesResult, &lt;span class="kwrd"&gt;out&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; UseScalarTypesResultSpecified)&lt;/pre&gt;
&lt;p&gt;The question was why this happens and how this can be fixed to look like the service’s method signature.&lt;/p&gt;
&lt;p&gt;Before we continue to see why this happens and how to fix it, the short answer is – Yes, you can make it look like the original contract by using message contracts. Continue reading to see how.&lt;/p&gt;
&lt;p&gt;Why this happens:&lt;/p&gt;
&lt;p&gt;In WCF the WSDL generated for the above method looks like so:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;UseScalarTypes&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;value1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;xs:int&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; 
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;value2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;xs:int&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; 
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;xs:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;xs:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;xs:element&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Notice the &lt;strong&gt;minOccurs&lt;/strong&gt;? int is a value type which means it doesn’t accept null values, but still WCF marks it as optional. When you use the “Add Service Reference” option of WCF in Visual Studio, the generator ignores that attribute and creates the method declaration in the client side the same way it is declared in the service contract. However, if you use the old “Add Web Reference” option, the generator checks the minOccurs, realizes that the variable is optional, and since this is a value type, it translates the optional into a set of variables: value + xxxSpecified.&lt;/p&gt;
&lt;p&gt;By the way, this is how the WSDL is created for the same method declaration when it is used in an ASMX-style web service:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:element&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;UseScalarTypes&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:element&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;maxOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;value1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;s:int&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; 
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;s:element&lt;/span&gt; &lt;span class="attr"&gt;minOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;maxOccurs&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;value2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;s:int&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; 
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:complexType&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;s:element&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note 1&lt;/strong&gt;: With ASMX web service, the minOccurs/maxOccurs is set properly because the “Add Web Reference” expects that, and therefore we don’t see this behavior with ASMX web service + add web reference. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note 2&lt;/strong&gt;: Since WCF ignores the minOccurs, using the “Add Service Reference” to consume that ASMX web service will result in a client-side method with the same signature as declared in the service (without the xxxSpecified).&lt;/p&gt;
&lt;p&gt;So now that we know why this happens, let’s see how to fix it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Create a set of message contracts, one for the request and one for the response (if you have one). &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: In the request message contract class, apply the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms586728.aspx"&gt;MessageContract&lt;/a&gt;&lt;/strong&gt; attribute and set the &lt;strong&gt;IsWrapped&lt;/strong&gt; parameter to &lt;strong&gt;false&lt;/strong&gt;, like so: &lt;/p&gt;&lt;pre class="csharpcode"&gt;[MessageContract(IsWrapped = &lt;span class="kwrd"&gt;false&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; UseScalarTypesRequest&lt;/pre&gt;
&lt;p&gt;Setting the IsWrapped to false will create the XML without a wrapping element, making the properties look like they are actually method parameters.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Add each parameter of the method to the class as a property, and apply the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.messagebodymemberattribute.aspx"&gt;MessageBodyMember&lt;/a&gt;&lt;/strong&gt; attribute to it. You can use this step to rename the property to use the naming convention of parameters by using the &lt;strong&gt;Name&lt;/strong&gt; parameter in the attribute. The result should look like so:&lt;/p&gt;&lt;pre class="csharpcode"&gt;[MessageContract(IsWrapped = &lt;span class="kwrd"&gt;false&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; UseScalarTypesRequest
{
  [MessageBodyMember(Name = &lt;span class="str"&gt;&amp;quot;value1&amp;quot;&lt;/span&gt;)]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Value1 { get; set; }
  [MessageBodyMember(Name = &lt;span class="str"&gt;&amp;quot;value2&amp;quot;&lt;/span&gt;)]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Value2 { get; set; }
}&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Do the same for the response message contract, this time you just need one property for the return type of the method, for example:&lt;/p&gt;&lt;pre class="csharpcode"&gt;[MessageContract(IsWrapped = &lt;span class="kwrd"&gt;false&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; UseScalarTypesResponse
{
  [MessageBodyMember]
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Result { get; set; }
}&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;: Change the method signature in the contract and service from using parameters to using the message contracts you’ve created, like so:&lt;/p&gt;&lt;pre class="csharpcode"&gt;UseScalarTypesResponse UseScalarTypes(UseScalarTypesRequest parameters)&lt;/pre&gt;
&lt;p&gt;Of course the immediate step will be to also change the implementation of your code to reflect the parameters being moved to a wrapper object - for convenience, you can leave your existing code in the service as is, change the contract, and then create the new methods which will simply call the older ones, like so:&lt;/p&gt;&lt;pre class="csharpcode"&gt;UseScalarTypesResponse UseScalarTypes(UseScalarTypesRequest parameters)
{
  UseScalarTypesResponse result = &lt;span class="kwrd"&gt;new&lt;/span&gt; UseScalarTypesResponse();
  result.Result = UseScalarTypes(parameters.Value1, parameters.Value2);
  &lt;span class="kwrd"&gt;return&lt;/span&gt; result;
}&lt;/pre&gt;
&lt;p&gt;That’s it, update your web reference in the client side, and watch how the method signature in the client side is without the xxxSpecified.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/31/wcf-asmx-interoperability-removing-the-annoying-xxxspecified-when-adding-a-web-reference-to-a-wcf-service.aspx" /&gt;&lt;/a&gt; 
&lt;div class="addthis_toolbox addthis_default_style "&gt;&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;&lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f27f7864794397c"&gt;&lt;/script&gt;
&lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=1003550" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASMX/default.aspx">ASMX</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/IsSpecified/default.aspx">IsSpecified</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/web+services/default.aspx">web services</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/add+web+reference/default.aspx">add web reference</category></item><item><title>What’s new in WCF 4.5? Improved streaming in IIS hosting</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx</link><pubDate>Wed, 18 Jan 2012 03:36:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:990797</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>30</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=990797</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx#comments</comments><description>&lt;p&gt;As promised in my &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx"&gt;previous post&lt;/a&gt;, I’m continuing my mission to inform you of new changes in WCF 4.5.&lt;/p&gt;
&lt;p&gt;This is the ninth post in the WCF 4.5 series. This post continues the previous posts on web-hosting features, and this time it is about the improved streaming capabilities of WCF when it is hosted in IIS.&lt;/p&gt;
&lt;p&gt;Previous posts:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;What’s new in WCF 4.5? a single WSDL file&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/19/what-s-new-in-wcf-4-5-configuration-tooltips-and-intellisense-in-config-files.aspx"&gt;What’s new in WCF 4.5? Configuration tooltips and intellisense in config files&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-configuration-validations.aspx"&gt;What’s new in WCF 4.5? Configuration validations&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-multiple-authentication-support-on-a-single-endpoint-in-iis.aspx"&gt;What’s new in WCF 4.5? Multiple authentication support on a single endpoint in IIS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;6. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/05/what-s-new-in-wcf-4-5-automatic-https-endpoint-for-iis.aspx"&gt;What’s new in WCF 4.5? Automatic HTTPS endpoint for IIS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;7. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/10/what-s-new-in-wcf-4-5-basichttpsbinding.aspx"&gt;What’s new in WCF 4.5? BasicHttpsBinding&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;8. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/31/what-s-new-in-wcf-4-5-changed-default-for-asp-net-compatibility-mode.aspx"&gt;What’s new in WCF 4.5? Changed default for ASP.NET compatibility mode&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you’ve ever tried creating a WCF service that uses streamed requests (for example a file upload service) and host it in IIS, you may have noticed a strange behavior in your WCF service – it would seem that WCF is late in receiving the request, as if it was entirely loaded into the memory, and then passed to WCF. So is it streamed? or is it actually buffered? well, it’s both.&lt;/p&gt;
&lt;p&gt;When you host a WCF service in IIS you also get a bit of the ASP.NET pipeline on the side, even if you don’t use the ASP.NET compatibility mode, this is documented in the &lt;a href="http://msdn.microsoft.com/en-us/library/aa702682.aspx"&gt;WCF Services and ASP.NET&lt;/a&gt; article on MSDN (look for the part about the PostAuthenticateRequest event). In .NET 4, there is a design flaw in ASP.NET which causes the requests sent to WCF to be buffered in ASP.NET. This buffering behavior causes several major side-effects:&lt;/p&gt;
&lt;p&gt;1. There is a latency between the time the streamed message is received by ASP.NET and the time the WCF service method is actually invoked.&lt;/p&gt;
&lt;p&gt;2. There is some memory consumption due to the buffering – the exact amount of memory consumed depends on the size of the message sent by the client, but it can even get to several hundred MBs if you increase the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx"&gt;MaxRequestLength&lt;/a&gt; of ASP.NET, the &lt;a href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits"&gt;MaxAllowedContentLength&lt;/a&gt; of IIS 7, and of course the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.wshttpbindingbase.maxreceivedmessagesize.aspx"&gt;MaxReceivedMessageSize&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.httptransportbindingelement.maxbuffersize.aspx"&gt;MaxBufferSize&lt;/a&gt; of WCF.&lt;/p&gt;
&lt;p&gt;3. When ASP.NET buffers the request, it uses both memory and disk. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.requestlengthdiskthreshold.aspx"&gt;requestLengthDiskThreshold&lt;/a&gt; configuration setting of ASP.NET controls when ASP.NET starts to use the disk. If you upload multiple files to WCF at once, you will start to see some delays due to multiple files being written to the disk at once. BTW, the files are written to an “upload” folder under the web application’s temporary asp.net folder (under c:\windows\Microsoft.NET\Framework\vX.X.XXXX\Temporary ASP.NET Files\) and are removed after the request is handled.&lt;/p&gt;
&lt;p&gt;To show this behavior, I have created a client application that uploads a 500MB file to a WCF service. The WCF service is hosted in IIS and is set to a streamed request (you can download the StreamingInIIS sample solution from &lt;font style="BACKGROUND-COLOR:#ffffff;"&gt;&lt;a href="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!460&amp;amp;parid=5EF5BE1AB30A6056!129"&gt;here&lt;/a&gt;&lt;/font&gt;). The following output shows some information about the time it took for the service to receive and handle the request, and the consumed memory:&lt;/p&gt;
&lt;p&gt;1 Client started upload on 17/01/2012 19:03:25 &lt;br /&gt;2 Available memory before starting is: 2701MB &lt;br /&gt;3 Client finished upload on 17/01/2012 19:03:44 &lt;br /&gt;4 Available memory after finishing is: 2699MB &lt;br /&gt;5 Available memory on ASP.NET is: 2701MB &lt;br /&gt;6 ASP.NET received upload at: 17/01/2012 19:03:28 &lt;br /&gt;7 Available memory on WCF is: 2122MB &lt;br /&gt;8 WCF started receiving file at: 17/01/2012 19:03:38 &lt;br /&gt;9 WCF finished receiving file at: 17/01/2012 19:03:43 &lt;br /&gt;File size is: 524288000 &lt;br /&gt;Press any key to continue . . .&lt;/p&gt;
&lt;p&gt;Some things to note about these results:&lt;/p&gt;
&lt;p&gt;1. Client started / Client finished (line 1+3) – the &lt;strong&gt;total time&lt;/strong&gt; the client waited for the service was &lt;strong&gt;19 seconds&lt;/strong&gt;; this includes the upload time, the buffering time of ASP.NET, and the time WCF handled the received stream.&lt;/p&gt;
&lt;p&gt;2. &lt;strong&gt;ASP.NET started receiving&lt;/strong&gt; the stream &lt;strong&gt;3 seconds &lt;/strong&gt;after the client began sending it (line 6).&lt;/p&gt;
&lt;p&gt;3. &lt;strong&gt;WCF started receiving&lt;/strong&gt; the stream &lt;strong&gt;10 seconds&lt;/strong&gt; after ASP.NET received started receiving it, and a total of &lt;strong&gt;13 seconds&lt;/strong&gt; from the time the client started sending it (line 8). In total, it took WCF &lt;strong&gt;5 seconds &lt;/strong&gt;to &lt;strong&gt;read the entire stream&lt;/strong&gt; from ASP.NET (line 8+9).&lt;/p&gt;
&lt;p&gt;4. Before the client sent the message, the &lt;strong&gt;available memory&lt;/strong&gt; in the machine was &lt;strong&gt;2701MB&lt;/strong&gt;, which is also the available memory when ASP.NET first received the message. By the time WCF got the request and started handling it, the available memory was &lt;strong&gt;2122MB&lt;/strong&gt; – about &lt;strong&gt;580MB were consumed from the memory&lt;/strong&gt; for this operation (lines 2, 5, and 7).&lt;/p&gt;
&lt;p&gt;5. As for the generated temp file, here is a screenshot of the temporary ASP.NET folder content:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_415EBE7C.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_451C634C.png" width="682" height="191" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: to show the ASP.NET information I used the ASP.NET compatibility mode. You can turn it off in the sample code if you want to verify that the problem also exists when we don’t use the compatibility mode (look at the difference between the time the client sent the request and the time WCF actually started handling the request – there should be a big latency).&lt;/p&gt;
&lt;p&gt;So we get that WCF 4 doesn’t handle well streamed content over IIS, but what about WCF 4.5? what has changed?&lt;/p&gt;
&lt;p&gt;In WCF 4.5 this just doesn’t happen – with .NET 4.5, ASP.NET doesn’t buffer the request, but rather forwards it directly to WCF, so we don’t get any latency, no memory consumption, and no disk usage.&lt;/p&gt;
&lt;p&gt;Want to see some proof? I ran the same demo code in Windows Server 8 with WCF 4.5 over IIS. I used a smaller file size (200MB), since this is a VM with less memory, however you can still see the difference quite clearly:&lt;/p&gt;
&lt;p&gt;1 Client started upload on 11/27/2011 7:23:18 AM &lt;br /&gt;2 Available memory before starting is: 942MB &lt;br /&gt;3 Client finished upload on 11/27/2011 7:23:46 AM &lt;br /&gt;4 Available memory after finishing is: 942MB &lt;br /&gt;5 Available memory on ASP.NET is: 941MB &lt;br /&gt;6 ASP.NET received upload at: 11/27/2011 7:23:20 AM &lt;br /&gt;7 Available memory on WCF is: 942MB &lt;br /&gt;8 WCF started receiving file at: 11/27/2011 7:23:20 AM &lt;br /&gt;9 WCF finished receiving file at: 11/27/2011 7:23:46 AM &lt;br /&gt;File size is: 209715200 &lt;br /&gt;Press any key to continue . . .&lt;/p&gt;
&lt;p&gt;First thing to note – memory consumption hasn’t changed throughout the execution – remains &lt;strong&gt;steady at ~942MB&lt;/strong&gt; (lines 2+4+5+7).&lt;/p&gt;
&lt;p&gt;As for the latency – &lt;strong&gt;WCF received the request &lt;/strong&gt;at the &lt;strong&gt;same time ASP.NET received it&lt;/strong&gt; (lines 6+8), which is &lt;strong&gt;2 seconds after the client &lt;/strong&gt;begins sending it.&lt;/p&gt;
&lt;p&gt;Oh, and since ASP.NET passed the stream directly to WCF, &lt;strong&gt;no temp file was created &lt;/strong&gt;!!&lt;/p&gt;
&lt;p&gt;So there you have it – proper streaming in WCF 4.5 over IIS.&lt;/p&gt;
&lt;p&gt;Stay tuned for more posts about the new features of WCF 4.5. You can also follow me on Twitter (@IdoFlatow) to get updates as soon as new posts are published.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/17/what-s-new-in-wcf-4-5-improved-streaming-in-iis-hosting.aspx" /&gt;&lt;/a&gt; &lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=990797" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Streamed/default.aspx">Streamed</category></item><item><title>Dear blog, it’s been a while since my last post</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx</link><pubDate>Mon, 16 Jan 2012 06:16:46 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:988921</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=988921</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx#comments</comments><description>&lt;p&gt;If you’ve been wondering where I disappeared to in the last couple of weeks, and if you are still waiting anxiously for my next post about WCF 4.5, fear not, I’m here, I’m alive, and I’m still kicking.&lt;/p&gt;  &lt;p&gt;It’s been quite a rough month, as I have been occupied knee deep in home renovations. If you’ve ever dealt with contractors, technicians, and handyman, you know the type of frustration I’m talking about.&lt;/p&gt;  &lt;p&gt;Between re-tiling my floors, replacing my kitchen cabinets, and re-painting my entire home, I also managed to find the time to deliver some courses on &lt;a href="http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=AzureWS&amp;amp;CategoryID=165"&gt;Windows Azure&lt;/a&gt;, &lt;a href="http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=6427A&amp;amp;CategoryID=165"&gt;IIS&lt;/a&gt;, &lt;a href="http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=AdvWCF&amp;amp;CategoryID=165"&gt;Advanced WCF&lt;/a&gt;, &lt;a href="http://www.sela.co.il/syl/Syllabus.aspx?CourseCode=50291B&amp;amp;CategoryID=165"&gt;Windows HPC Server&lt;/a&gt;, AppFabric Cache, and PowerShell.&lt;/p&gt;  &lt;p&gt;2012 is going to be very productive year – this year is going to be a lot about the new releases of .NET 4.5, VS11, and Windows Server 8. I’m guessing you’ll see many more posts about the new features of &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;WCF 4.5&lt;/a&gt; (soon to come – a new post about the new streaming features of WCF 4.5 over IIS), .NET 4.5, and VS11.&lt;/p&gt;  &lt;p&gt;I’m also continuing my voyage with BigData solutions which I’ve started last year with my work on the &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Windows+HPC+Server+2008+R2/default.aspx"&gt;Windows HPC Server 2008 R2&lt;/a&gt;, and the new HPC labs we’ve created in Sela for the &lt;a href="http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_hpcscheduler_unit"&gt;Windows Azure Platform Training Kit&lt;/a&gt;. This year is mostly going to be about Hadoop on Azure, so expect new labs and demos soon on the WAP TK (Windows Azure Platform Training Kit).&lt;/p&gt;  &lt;p&gt;This year I will continue to manage the Israeli Web Developer Community (WDCIL) along with &lt;a href="http://il.linkedin.com/pub/gal-kogman/9/853/220"&gt;Gal Kogman&lt;/a&gt;, and in a couple of days I will also start to moderate the WebDev IL MSDN forum with &lt;a href="http://blogs.microsoft.co.il/blogs/shlomo/"&gt;Sholomo Goldberg&lt;/a&gt;, AKA the DotNet Rabbi.&lt;/p&gt;  &lt;p&gt;I’m also continuing my speaking engagements this year, which ended last year with my sessions at &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/20/my-mvc-jquery-razor-nuget-iis-express-session-at-vs-live-2011-redmond.aspx"&gt;VSLive Redmond&lt;/a&gt; and MCT Summit in October and &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx"&gt;VSLive Orlando&lt;/a&gt; in December. Other than my usual appearances at Sela’s SDP conferences in Israel, I will also be speaking this April in the &lt;a href="http://www.developermarch.com/developersummit/speakers.html#IdoFlatow"&gt;Great Indian Developer Summit&lt;/a&gt; (GIDS) in Bangalore (India of course), and hopefully in additional conferences in Europe and the US (more information to come in the next couple of weeks).&lt;/p&gt;  &lt;p&gt;So check out for my &lt;a href="http://blogs.microsoft.co.il/blogs/idof/"&gt;posts&lt;/a&gt;, my &lt;a href="http://twitter.com/idoflatow"&gt;tweets&lt;/a&gt;, my courses, and my &lt;a href="http://speakermix.com/ido-flatow"&gt;speaking&lt;/a&gt; engagements, and don’t forget – if you need me, just turn on the bat signal, and I’ll come to your rescue, just kidding – you can always contact me through my blog, my tweeter account, or send me an email, and I’ll do my best to answer you promptly.&lt;/p&gt;  &lt;p&gt;Happy new year to y’all, enjoy the new leap year, and hopefully we’ll &lt;a href="http://en.wikipedia.org/wiki/2012_phenomenon"&gt;still be here&lt;/a&gt; to see 2013.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2012/01/16/dear-blog-it-s-been-a-while-since-my-last-post.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=988921" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Courses/default.aspx">Courses</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Azure/default.aspx">Azure</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/HPC/default.aspx">HPC</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Visual+Studio+Live_2100_+2011/default.aspx">Visual Studio Live! 2011</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Windows+HPC+Server+2008+R2/default.aspx">Windows HPC Server 2008 R2</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/speakers/default.aspx">speakers</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Visual+Studio+11/default.aspx">Visual Studio 11</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/MCT+Summit/default.aspx">MCT Summit</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WDCIL/default.aspx">WDCIL</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/engagements/default.aspx">engagements</category></item><item><title>Slide decks and demo code from my Visual Studio Live 2011 (Orlando) sessions</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx</link><pubDate>Thu, 08 Dec 2011 04:22:28 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:950730</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>35</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=950730</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx#comments</comments><description>&lt;p&gt;Yesterday I had two session in VS Live, one about the new features of WCF 4, and the other about the new way to develop web applications using ASP.NET MVC, the Razor view engine, jQuery, and IIS 7.5 Express.&lt;/p&gt;  &lt;p&gt;The slide decks and demo code for both sessions can be downloaded from here: &lt;a href="http://bit.ly/vslive-2011-orlando"&gt;http://bit.ly/vslive-2011-orlando&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I really enjoyed delivering both sessions, and congratulations to all the people that won &lt;a href="http://www.youtube.com/watch?v=UbdRmLaHMeY"&gt;Angry Bird balls&lt;/a&gt; for answering my questions, and for asking tough questions.&lt;/p&gt;  &lt;p&gt;Hopefully we will meet in next year’s VSLive (if my sessions are picked up again).&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/slide-decks-and-demo-code-from-my-visual-studio-live-2011-orlando-sessions.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=950730" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Presentation/default.aspx">Presentation</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/ASP.NET+MVC+3/default.aspx">ASP.NET MVC 3</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/Visual+Studio+Live_2100_+2011/default.aspx">Visual Studio Live! 2011</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/VS+Live/default.aspx">VS Live</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/razor/default.aspx">razor</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/jquery/default.aspx">jquery</category></item><item><title>Creating your own (customized) standard endpoints in WCF 4</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx</link><pubDate>Thu, 08 Dec 2011 04:10:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:950722</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=950722</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx#comments</comments><description>&lt;p&gt;Lately I’ve been writing and speaking a lot about WCF 4.5, but while delivering my “What’s new in WCF 4” session in &lt;a href="http://vslive.com/events/orlando-2011/home.aspx"&gt;Visual Studio Live&lt;/a&gt; yesterday I realized that there is one feature of WCF 4 that most people are not aware of, and do not really understand how useful it is – Standard Endpoints.&lt;/p&gt;
&lt;p&gt;In WCF we always have to specify a set of address+binding+contract (ABC) for our endpoints. If our endpoints also need to be configured, for example – change the binding configuration, or the endpoint behavior, then we need to add some more configuration. We can use default configuration (another feature of WCF 4), but if we have two common settings, we cannot set two defaults and we’re back to square one.&lt;/p&gt;
&lt;p&gt;Standard endpoints change the way we define endpoints – with standard endpoints we specify a special “kind” name in our endpoint, which automatically sets our endpoint’s address, binding, contract, binding configuration, and endpoint behavior.&lt;/p&gt;
&lt;p&gt;For example – if we define the following endpoint:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mex&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;kind&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mexEndpoint&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The above endpoint will automatically be set with the &lt;strong&gt;mexHttpBinding&lt;/strong&gt; and the &lt;strong&gt;IMetadataExchange&lt;/strong&gt; contract.&lt;/p&gt;
&lt;p&gt;If we define the following endpoints:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;web&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;kind&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;webHttpEndpoint&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MyNS.IMyContract&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;We will get an endpoint which uses &lt;strong&gt;webHttpBinding&lt;/strong&gt;, and automatically gets the &lt;strong&gt;webHttp&lt;/strong&gt; endpoint behavior.&lt;/p&gt;
&lt;p&gt;Although this is quite nice, this is the least we can do with standard endpoints. The real use of standard endpoints is when you create some of your own.&lt;/p&gt;
&lt;p&gt;Image the following – you are a part of an infrastructure team in your organization and you need to explain to the dev teams which endpoint configuration they should use in their projects – “Please use &lt;strong&gt;NetTcp &lt;/strong&gt;binding, with &lt;strong&gt;increased message size limits&lt;/strong&gt;, with either &lt;strong&gt;security none or transport&lt;/strong&gt;, and don’t forget to &lt;strong&gt;increase the send timeout”&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;One way to do this is to send a memo to all the dev teams, hoping everyone follow your instructions to the letter. Another way you can do that is to create your own standard endpoint with all of the above configuration and just send it to the dev teams to use.&lt;/p&gt;
&lt;p&gt;First of all you need to create your custom endpoint:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CompanyNameStandardEndpoint : ServiceEndpoint&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; _isSecured;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; CompanyNameStandardEndpoint(ContractDescription contract)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        : &lt;span class="kwrd"&gt;base&lt;/span&gt;(contract)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.Binding = &lt;span class="kwrd"&gt;new&lt;/span&gt; NetTcpBinding();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        ResetBindingConfiguration(&lt;span class="kwrd"&gt;this&lt;/span&gt;.Binding);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.IsSystemEndpoint = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; IsSecured&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        get&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; _isSecured;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        set&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;            _isSecured = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (_isSecured)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                (&lt;span class="kwrd"&gt;this&lt;/span&gt;.Binding &lt;span class="kwrd"&gt;as&lt;/span&gt; NetTcpBinding).Security.Mode = SecurityMode.Transport;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                (&lt;span class="kwrd"&gt;this&lt;/span&gt;.Binding &lt;span class="kwrd"&gt;as&lt;/span&gt; NetTcpBinding).Security.Mode = SecurityMode.None;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    &lt;span class="rem"&gt;// Receive a dynamic object instead of creating separate methods&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    &lt;span class="rem"&gt;// for netTcp, basicHttp, WSHttpBinding...&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ResetBindingConfiguration(dynamic binding)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        binding.SendTimeout = TimeSpan.FromMinutes(5);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;        binding.MaxReceivedMessageSize = Int32.MaxValue;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        binding.MaxBufferSize = Int32.MaxValue;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Line 8 makes sure that your endpoint will use NetTcp binding.&lt;/p&gt;
&lt;p&gt;Line 9 will call a method that initializes the binding settings (lines 36-41).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note &lt;/strong&gt;: the &lt;strong&gt;ResetBindingConfiguration &lt;/strong&gt;method receives a dynamic object because for some reason some of the binding properties such as the &lt;strong&gt;MaxReceivedMessageSize &lt;/strong&gt;and the &lt;strong&gt;MaxBufferSize &lt;/strong&gt;are defined in each of the bindings instead of being defined in a base Binding class. The dynamic will allow us to change our code later on to support both TCP and HTTP bindings without duplicating our method for overloads.&lt;/p&gt;
&lt;p&gt;Line 10 specifies that this is a user-defined endpoint and not a system endpoint.&lt;/p&gt;
&lt;p&gt;Lines 13-32 are responsible of handling the user’s selection to whether the endpoint is secured or not by changing the security mode to either &lt;strong&gt;Transport &lt;/strong&gt;or &lt;strong&gt;None&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So now we have a new standard endpoint that initializes the binding to &lt;strong&gt;NetTcpBinding&lt;/strong&gt;, sets the timeout and message size, and knows to set the security according to the user’s selection. We can now add this endpoint in code to our service by calling the following code:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;CompanyNameStandardEndpoint newEndpoint = &lt;span class="kwrd"&gt;new&lt;/span&gt; CompanyNameStandardEndpoint(&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;        ContractDescription.GetContract(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(IService1)));&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;newEndpoint.IsSecured = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;newEndpoint.Address = &lt;span class="kwrd"&gt;new&lt;/span&gt; EndpointAddress(tcpBaseAddress + &lt;span class="str"&gt;&amp;quot;companyUnsecured&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;host.AddServiceEndpoint(newEndpoint);            &lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To be able to add this endpoint configuration in the config file, you will need to add some boilerplate code:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CompanyNameStandardEndpointCollectionElement :&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    StandardEndpointCollectionElement&amp;lt;CompanyNameStandardEndpoint, CompanyNameStandardEndpointElement&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CompanyNameStandardEndpointElement : StandardEndpointElement&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; ServiceEndpoint CreateServiceEndpoint(ContractDescription contractDescription)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; CompanyNameStandardEndpoint(contractDescription);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; IsSecured&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; (&lt;span class="kwrd"&gt;bool&lt;/span&gt;)&lt;span class="kwrd"&gt;base&lt;/span&gt;[&lt;span class="str"&gt;&amp;quot;isSecured&amp;quot;&lt;/span&gt;]; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        set { &lt;span class="kwrd"&gt;base&lt;/span&gt;[&lt;span class="str"&gt;&amp;quot;isSecured&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; ConfigurationPropertyCollection Properties&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        get&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            ConfigurationPropertyCollection properties = &lt;span class="kwrd"&gt;base&lt;/span&gt;.Properties;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            properties.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; ConfigurationProperty(&lt;span class="str"&gt;&amp;quot;isSecured&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;bool&lt;/span&gt;), &lt;span class="kwrd"&gt;false&lt;/span&gt;, ConfigurationPropertyOptions.None));&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; properties;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Type EndpointType&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CompanyNameStandardEndpoint); }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        CompanyNameStandardEndpoint customEndpoint = (CompanyNameStandardEndpoint)endpoint;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        customEndpoint.IsSecured = &lt;span class="kwrd"&gt;this&lt;/span&gt;.IsSecured;            &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement channelEndpointElement)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        CompanyNameStandardEndpoint customEndpoint = (CompanyNameStandardEndpoint)endpoint;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        customEndpoint.IsSecured = &lt;span class="kwrd"&gt;this&lt;/span&gt;.IsSecured;            &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;            &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;           &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code is a basic configuration element code. The most important part is lines&amp;nbsp; 13-17 in which you need to repeat each of the properties you created in the custom standard element (for a mapping between XML and CLR) and line 24 where you add all the properties that can be set in the configuration file, so the configuration can be validated. &lt;/p&gt;
&lt;p&gt;Once you create the above code, you need just on more step to use the new endpoint kind in your configuration – you need to tell WCF that you have a new service endpoint. To do that you add the following XML in your &amp;lt;system.serviceModel&amp;gt; section:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;extensions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpointExtensions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;      &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;companyNameEndpoint&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;      &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TestWcfStandardEndpoints.CompanyNameStandardEndpointCollectionElement, TestWcfStandardEndpoints&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;endpointExtensions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;extensions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note: On MSDN you can find a good explanation on &lt;a href="http://msdn.microsoft.com/en-us/library/ee358762.aspx"&gt;standard endpoints&lt;/a&gt;, but the extensions configuration part is incorrect, the above configuration is the correct one (the correct element in the &amp;lt;extensions&amp;gt; is &lt;strong&gt;&amp;lt;endpointExtensions&amp;gt;&lt;/strong&gt; and not &lt;strong&gt;&amp;lt;standardEndpointExtensions&amp;gt;&lt;/strong&gt; as it appears in the article).&lt;/p&gt;
&lt;p&gt;Now you are ready to declare your new endpoints and configure them:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;services&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TestWcfStandardEndpoints.Service1&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;basicHttpBinding&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;            &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TestWcfStandardEndpoints.IService1&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mex&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;            &lt;span class="attr"&gt;kind&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mexEndpoint&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;companySecured&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;            &lt;span class="attr"&gt;kind&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;companyNameEndpoint&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            &lt;span class="attr"&gt;endpointConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;securedEndpoint&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TestWcfStandardEndpoints.IService1&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;service&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;services&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;standardEndpoints&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;companyNameEndpoint&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;standardEndpoint&lt;/span&gt; &lt;span class="attr"&gt;isSecured&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;securedEndpoint&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;companyNameEndpoint&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;standardEndpoints&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In lines 7-10 we define the endpoint with the new “kind” (line 9) and specify where we configure the rest of the endpoint (line 10).&lt;/p&gt;
&lt;p&gt;Lines 14-18 contains the configuration of the standard endpoint which we created.&lt;/p&gt;
&lt;p&gt;So to conclude, standard endpoints are an easy way to create fully-configured endpoints with binding configuration, contract settings, and endpoint behaviors. It’s mostly useful when wanting to create the same endpoint over and over again in multiple projects (which happens in 99.99% of the time).&lt;/p&gt;
&lt;p&gt;Don’t bother copy pasting all the above code – you can just download the complete solution from &lt;a href="https://skydrive.live.com/redir.aspx?cid=5ef5be1ab30a6056&amp;amp;resid=5EF5BE1AB30A6056!458&amp;amp;parid=root"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/12/07/creating-your-own-customized-standard-endpoints-in-wcf-4.aspx" /&gt;&lt;/a&gt; &lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=950722" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/standard+endpoint/default.aspx">standard endpoint</category></item><item><title>Slide decks and sample code from my WCF 4.5 open-house in Microsoft</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx</link><pubDate>Mon, 28 Nov 2011 05:35:39 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:942316</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=942316</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx#comments</comments><description>&lt;p&gt;Today I delivered a half-day talk about WCF on the following subjects:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;The new features of WCF 4.5       &lt;br /&gt;&lt;/strong&gt;We talked about configuration simplicity, WebSocket and UDP support, streaming fixes for IIS, binary compression, and more.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Monitoring and troubleshooting WCF services (WCF 3.5/4/4.5)       &lt;br /&gt;&lt;/strong&gt;We talked about performance counters, ETW, WMI, AppFabric, sniffing tools, tracing and message logging, instancing, concurrency, load tests and more.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;According to the events website at &lt;a href="http://events.microsoft.com"&gt;http://events.microsoft.com&lt;/a&gt;, it looks like this was the first Microsoft event worldwide about WCF 4.5. We like new technologies in Israel &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.microsoft.co.il/blogs/idof/wlEmoticon-smile_697E2F33.png" /&gt;.&lt;/p&gt;  &lt;p&gt;We had a full-house (~100 people), got a lot of questions from people during and after the session, so it was lots of fun. I really enjoyed delivering the session, and I hope that in the coming year we will be able to see the RTM of Visual Studio 11 and .NET 4.5.&lt;/p&gt;  &lt;p&gt;If you missed today’s session, you have another chance to hear me talk about WCF 4.5 in the November meeting of the Web Developers Community (WDCIL) this Tuesday in Microsoft Raanana. You can get more information and register to the event at &lt;a title="http://wdcil2011nov.eventbrite.com" href="http://wdcil2011nov.eventbrite.com"&gt;http://wdcil2011nov.eventbrite.com&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the meanwhile, you can &lt;strong&gt;download &lt;/strong&gt;the presentation and the sample code I’ve shown from my SkyDrive at &lt;a href="http://bit.ly/wcf45msdn"&gt;http://bit.ly/wcf45msdn&lt;/a&gt; – this also includes the WCF 4.5 demos I showed, so don’t forget to install VS 11 and .NET 4.5 (&lt;a href="http://reddevnews.com/blogs/rdn-express/2011/11/back-to-app-migrations-with-ms-net-vnext.aspx"&gt;preferably&lt;/a&gt; on a VM).&lt;/p&gt;  &lt;p&gt;I want to repeat what I told people in the event today – the WCF team is eager to know what you think about WCF, what is missing in WCF to make your work easier, and if you encountered any bugs in the product. There are several ways by which you can contact them:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;For WCF 4.5&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Visit the .NET 4.5 forum at: &lt;a title="http://forums.asp.net/1239.aspx/1?ASP+NET+4+5+ASP+NET+WCF+and+Visual+Studio+11+Developer+Previews" href="http://forums.asp.net/1239.aspx/1?ASP+NET+4+5+ASP+NET+WCF+and+Visual+Studio+11+Developer+Previews"&gt;http://forums.asp.net/1239.aspx/1?ASP+NET+4+5+ASP+NET+WCF+and+Visual+Studio+11+Developer+Previews&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Report an issue, feedback, or bugs on Microsoft Connect: &lt;a href="https://connect.microsoft.com/VisualStudio"&gt;https://connect.microsoft.com/VisualStudio&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;For WCF 4&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Visit the WCF forum at: &lt;a title="http://social.msdn.microsoft.com/Forums/en/wcf" href="http://social.msdn.microsoft.com/Forums/en/wcf"&gt;http://social.msdn.microsoft.com/Forums/en/wcf&lt;/a&gt;&lt;/li&gt;      &lt;li&gt; Report an issue, feedback, or bugs on Microsoft Connect: &lt;a title="https://connect.microsoft.com/wcf" href="https://connect.microsoft.com/wcf"&gt;https://connect.microsoft.com/wcf&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;If you want to read more about WCF 4.5, check out previous posts I published. I will publish new in-depth posts on the new features, so stay tuned. You can also follow me on Twitter @IdoFlatow&lt;/p&gt;  &lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;What’s new in WCF 4.5? a single WSDL file&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/19/what-s-new-in-wcf-4-5-configuration-tooltips-and-intellisense-in-config-files.aspx"&gt;What’s new in WCF 4.5? Configuration tooltips and intellisense in config files&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-configuration-validations.aspx"&gt;What’s new in WCF 4.5? Configuration validations&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/25/what-s-new-in-wcf-4-5-multiple-authentication-support-on-a-single-endpoint-in-iis.aspx"&gt;What’s new in WCF 4.5? Multiple authentication support on a single endpoint in IIS&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;6. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/05/what-s-new-in-wcf-4-5-automatic-https-endpoint-for-iis.aspx"&gt;What’s new in WCF 4.5? Automatic HTTPS endpoint for IIS&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;7. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/10/what-s-new-in-wcf-4-5-basichttpsbinding.aspx"&gt;What’s new in WCF 4.5? BasicHttpsBinding&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;8. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/31/what-s-new-in-wcf-4-5-changed-default-for-asp-net-compatibility-mode.aspx"&gt;What’s new in WCF 4.5? Changed default for ASP.NET compatibility mode&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you want to learn more about WCF, check out the following WCF sessions we have at &lt;a href="http://www.sela.co.il/s/SDP/Dec2011/index.html"&gt;Sela’s DevDays&lt;/a&gt; next week:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;WCF Crash Course - &lt;a href="http://www.sela.co.il/s/SDP/Dec2011/tutorials2.html#d53"&gt;http://www.sela.co.il/s/SDP/Dec2011/tutorials2.html#d53&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Advanced WCF - &lt;a href="http://www.sela.co.il/s/SDP/Dec2011/tutorials2.html#d63"&gt;http://www.sela.co.il/s/SDP/Dec2011/tutorials2.html#d63&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/11/28/slide-decks-and-sample-code-from-my-wcf-4-5-open-house-in-microsoft.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=942316" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/open+house/default.aspx">open house</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/monitoring/default.aspx">monitoring</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category></item><item><title>My WCF Session at VS Live 2011 Redmond</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx</link><pubDate>Wed, 19 Oct 2011 21:17:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:917911</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=917911</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx#comments</comments><description>&lt;p&gt;Yesterday I had my WCF 4 session in VS Live, where I showed some of the new features of WCF 4, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configuration simplification&lt;/li&gt;
&lt;li&gt;IIS hosting features&lt;/li&gt;
&lt;li&gt;WebHttp improvements&lt;/li&gt;
&lt;li&gt;Routing services&lt;/li&gt;
&lt;li&gt;Discovery services&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;I also talked a bit about some other new WCF 4 features such as the DataContractResolver type, the new ReceiveContext API for MSMQ bindings, Monitoring WCF with ETW and PerfMon, the new binary stream encoder, and the new throttling defaults.&lt;/p&gt;
&lt;p&gt;Those of you who stayed till the end also heard about some of the new features that will be in WCF 4.5.&lt;/p&gt;
&lt;p&gt;So if you’ve missed the session, had to step outside for an important call, or you just want to try out the samples I showed, you can go ahead and download the slides and samples from here: &lt;a title="http://bit.ly/vslive-2011-redmond" href="http://bit.ly/vslive-2011-redmond"&gt;http://bit.ly/vslive-2011-redmond&lt;/a&gt;&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/19/my-wcf-session-at-vs-live-2011-redmond.aspx" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=917911" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/VS+Live/default.aspx">VS Live</category></item><item><title>The month of October bears good news</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx</link><pubDate>Mon, 03 Oct 2011 01:46:20 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:909779</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=909779</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/MVP_FullColor_ForScreen---Blog_61573C6F.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="MVP_FullColor_ForScreen - Blog" border="0" alt="MVP_FullColor_ForScreen - Blog" align="right" src="http://blogs.microsoft.co.il/blogs/idof/MVP_FullColor_ForScreen---Blog_thumb_3AA8B022.png" width="119" height="185" /&gt;&lt;/a&gt;October began yesterday with an email from Microsoft congratulating me for receiving &lt;strong&gt;Microsoft’s Most Valuable Professional (MVP) award&lt;/strong&gt;. I’m a connected system developer MVP, which kind of describes my work – working with distributed systems, connecting clients and servers, building WCF services, ASP.NET applications, working with IIS servers, etc…&lt;/p&gt;  &lt;p&gt;This is the first time I receive the MVP award, so I’m quite excited. Special thanks to the people who helped with my nomination – Guy Burstein and Meir Pinto from Microsoft Israel, to my managers at Sela Group – David Bassa and Ishai Ram, and of course to all of you that are reading my blog, that come to my sessions in conferences, to the hundreds of people I trained over the years, and to those whose nickname I only know that marked my answers as correct in forums. Congratulations also to my colleagues in Sela – Arik Poznanski for his new MVP in Visual C#, and to Gil Fink for his third year in a row of being a Data Platform MVP.&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/azure_70CA2871.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="azure" border="0" alt="azure" align="right" src="http://blogs.microsoft.co.il/blogs/idof/azure_thumb_54008D8F.png" width="132" height="132" /&gt;&lt;/a&gt;As I said before, this month bears many good news – next week I’m heading to Microsoft HQ in Redmond, where I’m going to attend an &lt;strong&gt;Azure Platform Metro course&lt;/strong&gt;. Metro courses are special Microsoft courses that are constructed by DPE teams in Microsoft (developer and platform evangelists) and are intended to teach new technologies for eager developers. I’m going to participate in this course with several other trainers from all over the world, and learn the newest stuff in the Azure platform from Microsoft’s experts, so it’s going to be a great experience for me, and I’m very much looking forward to it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/VSLiveRedmond_2A3D129C.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="VSLiveRedmond" border="0" alt="VSLiveRedmond" align="right" src="http://blogs.microsoft.co.il/blogs/idof/VSLiveRedmond_thumb_67E9FA58.jpg" width="319" height="76" /&gt;&lt;/a&gt;October goes on with good stuff – the following week after the course I’m going to attend the &lt;strong&gt;Visual Studio Live! conference in Redmond&lt;/strong&gt; (17-21 of October), this time not as a listener, but as a speaker.     &lt;br /&gt;I’m giving two sessions in the conference, about the new features of WCF 4, and about the new face of web development – ASP.NET MVC, jQuery, and Razor.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/MCTSummit_65CCFB8F.gif"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="MCTSummit" border="0" alt="MCTSummit" align="right" src="http://blogs.microsoft.co.il/blogs/idof/MCTSummit_thumb_1D330CBE.gif" width="320" height="94" /&gt;&lt;/a&gt;And for the finale of October – after my two sessions, I’m catching a flight to San-Francisco to attend the &lt;strong&gt;North-America 2011 MCT Summit&lt;/strong&gt; (Microsoft Certified Trainers Summit), which is also during 19-21 of October. In the summit I will be presenting yet again the new features of WCF 4, but will also probably spend some time talking about teaching tips for the official WCF 4 course (10263A) that I co-authored last year for Microsoft.&lt;/p&gt;  &lt;p&gt;If you are working in the area of Seattle or San-Francisco, and &lt;strong&gt;interested in&lt;/strong&gt; &lt;strong&gt;WCF consulting or training&lt;/strong&gt;, let me know as I have a few days off that I can dedicate to consultations and courses. I will be available in the Seattle area between 14-17 of October, and in the San-Francisco area between 21-22 of October. I also have a 9-hour connection in Newark on the 23rd, if you want a quick consultation &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.microsoft.co.il/blogs/idof/wlEmoticon-smile_347E112F.png" /&gt;&lt;/p&gt;  &lt;p&gt;October started great with my new MVP, and it’s going to end great with two weeks of learning and speaking in the US.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/02/the-month-of-october-bears-good-news.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=909779" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/OffTopic/default.aspx">OffTopic</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/MCT+Summit/default.aspx">MCT Summit</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/VS+Live/default.aspx">VS Live</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/MVP/default.aspx">MVP</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/connected+system+developer/default.aspx">connected system developer</category></item><item><title>What’s new in WCF 4.5? a single WSDL file</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx</link><pubDate>Sat, 17 Sep 2011 23:04:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:902087</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=902087</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx#comments</comments><description>&lt;p&gt;This is the second post in the WCF 4.5 series, and this time we’ll talk about WSDL files.&lt;/p&gt;
&lt;p&gt;Previous posts:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A few weeks ago, I &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;posted&lt;/a&gt; about the difference between exposing the service metadata through WSDL and through a MEX endpoint. One of the things I noted in the post was that the metadata exposed through a WSDL file is actually one part of the overall metadata – in addition to the WSDL file, there is usually an additional set of files, XSD files, that contain the data contracts of the service. For WCF 4 and previous versions, the schema part in the WSDL is a set of import directives for additional files:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_0CF7CAD0.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_7825D24F.png" width="665" height="128" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So what has changed in WCF 4.5? When you browse to a WCF 4.5 service’s metadata URL, you will see the following WSDL options:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_7BE3771F.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_1975521F.png" width="821" height="189" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In addition to the ?wsdl option, we now get another option - ?singleWsdl. The singleWsdl link will return a single WSDL file, containing all the schemas in it:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_2FE7F0A6.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_2C8658FE.png" width="793" height="313" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Each of the schema elements contains the schema that was previously imported from an external file.&lt;/p&gt;
&lt;p&gt;So in my previous &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;post&lt;/a&gt;, where I listed the reasons why to use MEX instead of WSDL, we can omit the first reason – “If you want to make as less calls as possible to your service in order to get its metadata (one call instead of several).”&lt;/p&gt;
&lt;p&gt;Stay tuned for more posts about the new features of WCF 4.5. You can also follow me on Twitter (@IdoFlatow) to get updates as soon as new posts are published.&lt;/p&gt;
&lt;p&gt;The RTM of .NET 4.5 is still to come, and I assume many of you are still adjusting to WCF 4. If you want to learn more about the new features of WCF 4, come to my &lt;a href="http://vslive.com/Events/Redmond-2011/Sessions/Tuesday/T8-Whats-New-in-WCF4.aspx"&gt;session&lt;/a&gt; at Visual Studio Live! 2011 in Redmond (October 17-21).&lt;/p&gt;
&lt;p&gt;Also, if you are an MCT and reside in the US, come hear my session about WCF 4 at the &lt;a href="http://www.mctsummit.org/"&gt;MCT 2011 North-America Summit&lt;/a&gt; that will be held in San-Francisco (October 19-21).&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx" /&gt;&lt;/a&gt; &lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=902087" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WSDL+vs+MEX/default.aspx">WSDL vs MEX</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/wsdl/default.aspx">wsdl</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category></item></channel></rss>