Thursday, 15 September 2011

What is netTcpBinding in WCF?

 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
The binding based on the TcpTransportBindingElement
The below list of binding properties that are configurable on the netTcpBinding:

netTcpBinding Service Configuration
<service name="EssentialWCF.Service1" behaviorConfiguration="EssentialWCF.Service1Behavior">
            <add baseAddress="net.tcp://localhost/EssentialWCF"/>

<endpoint address="" binding="netTcpBinding" contract="EssentialWCF.IService1"></endpoint>

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

How to create a NetTcpBinding, setting the security mode and transport credential type.

NetTcpBinding binding = new NetTcpBinding();
        binding.Security.Mode = SecurityMode.Transport;
        binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;

  • There is no interoperability required because both applications are built on .Net. So the communication can be optimized for the best performance.
  • The NetTcpBinding uses binary encoding and the TCP protocol to achieve the best performance across the network.

  • We can configurable different netTcpBinding elements based on requirement.

  • The NetTcpBinding binding is not appropriate is when a firewall separates the two .NET applications. Often the only way you can communicate across a firewall is to use HTTP.

No comments:

Post a Comment

Please Give Your Valuable Comments on this Topic