New Features in WCF 4.5 – Part 7

By | May 14, 2014

It’s part-7 of WCF 4.5 Tutorial Series and we are going to explore further new features of Windows Communication Foundation v4.5. Today, we will discuss about the following features:

  • Support for UDP Binding
  • Compression Support in Binary Encoder
In this WCF Tutorial Series, so far we have covered the following new features in WCF 4.5.

WCF – UDP Binding Support

Support for UDP Binding was much awaited in Windows Communication Foundation. If we compare TCP with UDP as protocol, the difference between the two is:

TCP is connection-oriented protocol that sends message and guarantees that it’s reached destination. On the other hand, UDP is connectionless protocol that sends message and don’t look back that either it’s reached to destination or not. In one-way operation messages, UDP protocol is required because it’s comparatively faster than TCP. Now in WCF 4.5, UDP as communication protocol is supported through UDP binding.
So, simply we can use following configuration settings using UDPBinding as follows:
  <service name=”MyUDPService” behaviorConfiguration=”MyUDPServiceBehavior”>
<endpoint address=”” 
binding=”udpBinding” 
bindingConfiguration=”UDPBindingSettings”
contract=”IMyUDPService”>
<identity>
<dns value=”localhost” />
</identity>
          </endpoint>
  </service>

WCF – Compression support for Binary Encoder

In Windows Communication Foundation v4.5, Compression support is available for Binary Encoder through CompressionFormat property. This Compression feature can work for HTTP, HTTPS as well as TCP protocol. CompressionFormat property can have one of the possible CompressionFormat enum values:

  • Deflate – Deflate Compression
  • GZip – GZip Compression
  • None – No compression at all.

For compression support to work properly, there are few constraints as follows:

  1. Client as well as Service both must have configure CompressionFormat property. Client and Service will not be unable to communicate (throwing a protocol mismatch exception) unless both agreed to use compression.
  2. Custom binding will be used to enable compression support for Binary Encoder.
       <customBinding>
            <binding name=”BinaryCompressionBinding”>
                <binaryMessageEncoding compressionFormat=”GZip”/>
                      <httpTransport />
               </binding>
        </customBinding>

Hopefully, New amazing features discussed in this WCF Tutorial will further help out to WCF (Windows Communication Foundation) developer.

Top 10 Interview Questions and Answers Series:

Category: Uncategorized Tags: , ,

About IMRAN ABDUL GHANI

Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at www.webdevelopmenthelp.net, www.topwcftutorials.net, and www.sharepointfordummies.net.