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
<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>
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;
Advantages:
- 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.
Disadvantages:
- 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