Mohammed Atef’s Technical blog

Select WCF Binding

While I was reading this book Addison.Wesley.Essential.Windows.Communication.Foundation, I read very useful and important topic about WCF selects binding. so I would like to share this nice information to all.

Introduction

Actually there are nine preconfigured bindings in WCF, Each of these provides the means for a particular distributed computing need, there are several factors that  determine which binding to choose for a specific application, including security, interoperability, reliability, performance, and transaction requirements. You can study these cases throw the below image.
 wcfbinding
Each of the bindings supports a particular communication scenario, such as cross- machine, on-machine, and interoperable communication using Web services; I will explain each communication scenario in details with very simple example.

netTcpBinding

 The netTcpBinding binding is designed to support communication between .NET applications that are deployed on separate machines across a network, including communication across intranets and the Internet. This type of communication called cross-machine communication.
Address format: net.tcp://{hostname}[:port]/{service location}
Default port number:808

netTcpBinding Service Configuration

<services>
<service name="EssentialWCF.Service1" behaviorConfiguration="EssentialWCF.Service1Behavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost/EssentialWCF"/>
          </baseAddresses>
        </host>
<endpoint address="" binding="netTcpBinding" contract="EssentialWCF.IService1"></endpoint>
</service>
</services>

netTcpBinding Client Configuration

<client>
<endpoint address="net.tcp://localhost/Service1.svc" binding="netTcpBinding" contract="ServiceReference1.IService1"></endpoint>
</client>

netNamedPipeBinding

 WCF supports interprocess and intraprocess communication scenarios with the netNamedPipeBinding binding.the netNamedPipeBinding binding leverages a named pipes transport. This is a great binding to use for doing interprocess communication (IPC) because it provides a significant performance increase over the other standard bindings available in WCF.
This type of communication called Local machine communication.
Address format: net.pipe://{hostname}/{service location}
Default port number:808

 

 

netNamedPipeBinding Service Configuration
<services>
<service name="EssentialWCF.Service1" behaviorConfiguration="EssentialWCF.Service1Behavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.pipe://localhost/EssentialWCF"/>
          </baseAddresses>
        </host>
<endpoint address="" binding="netNamedPipeBinding" contract="EssentialWCF.IService1"></endpoint>
</service>
</services>
netNamedPipeBinding Client Configuration

basicHttpBinding

<client>
<endpoint address="net.pipe://localhost/Service1.svc" binding="netNamedPipeBinding" contract="ServiceReference1.IService1"></endpoint>
</client>

 

The basicHttpBinding binding offers support for Web service communication based on the WS-I Basic Profile 1.1 (WS-BP 1.1) specification. This includes standards such as SOAP 1.1, WSDL 1.1, and Message Security 1.0. This type of communication called web service communication.

Address format: http://{hostname}/{service location} and https://{hostname}/{service location}
Default port number:80 for http and 443 for https

basicHttpBinding Service Configuration

basicHttpBinding Client Configuration

<client>
<endpoint address="http://localhost/Service1.svc" binding=" basicHttpBinding " contract="ServiceReference1.IService1"></endpoint>
</client>

wsHttpBinding

The wsHttpBinding binding provides interoperable communication across heterogeneous platforms as well as advanced infrastructure level protocols, such as security, reliable messaging, and transactions. The wsHttpBinding binding is the default binding in .NET Framework 3.0 whenever you need interoperable communication based on Web services. This type of communication called Advanced web service communication.

Address format: http://{hostname}:{port}/{service location} and https://{hostname}:{port}/{service location}Default port number:80 for http and 443 for https

wsHttpBinding Service Configuration

wsHttpBinding Client Configuration

<client>
<endpoint address="http://localhost/Service1.svc" binding=" wsHttpBinding " contract="ServiceReference1.IService1"></endpoint>
</client>

ws2007HttpBinding

.NET Framework 3.5 introduces a new binding for Web service interoperability called the ws2007HttpBinding binding. This binding is similar to the

ws2007HttpBinding binding except that it supports the latest WS-* standards available for messaging, security, reliable messaging, and transactions.This type of communication called Advanced web service communication.

Address format: http://{hostname}:{port}/{service location} and https://{hostname}:{port}/{service location}Default port number:80 for http and 443 for https

ws2007HttpBinding Service Configuration

ws2007HttpBinding Client Configuration

<client>
<endpoint address="http://localhost/Service1.svc" binding=" ws2007HttpBinding " contract="ServiceReference1.IService1"></endpoint>
</client>

wsDualHttpBinding

The wsDualHttpBinding binding is similar to the wsHttpBinding binding, with additional support for duplex communication and lack of support for transport-level security. This type of communication called Advanced web service communication.

Address format: http://{hostname}:{port}/{service location}
Default port number:80 for http

wsDualHttpBinding Service Configuration

<services>
<service name="EssentialWCF.Service1" behaviorConfiguration="EssentialWCF.Service1Behavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost/EssentialWCF"/>
          </baseAddresses>
        </host>
<endpoint address="" binding="wsDualHttpBinding" contract="EssentialWCF.IService1"></endpoint>
</service>
</services>

wsDualHttpBinding Client Configuration

<client>
<endpoint address="http://localhost/Service1.svc" binding="wsDualHttpBinding" contract="ServiceReference1.IService1"></endpoint>
</client>

Now I think we can decide with WCF binding type we can use in our solutions.

I hope this help.

About these ads

June 9, 2009 - Posted by | WCF | , , , , , ,

1 Comment »

  1. Thanks good information in a small summary

    Comment by Shailk | January 30, 2014 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: