When a service and a client both are of .Net and reside on different machines then we can choose the preconfigured netTcpBinding to publish a WCF Service to the client. netTcpBinding is best suited when both the client and the service are of .Net and communicating to each other either over Intranet or Internet. Since both the service and client are in .Net, performance of this binding is very much optimized for the best performance. There is no overload of interoperability. netTcpBinding uses TCP Protocol and Binary Encoding. A few default properties of netTcpBinding is listed in the diagram below. Now let us create a WCF service using netTcpBinding. The following is what we are going to do.
static void Main(string args)
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
string result = proxy.GetDataUsingnetTcpBinding(99999);
On running we will get the output as below.
In this article we saw how we can use netTcpBinding for communication between two .Net Applications residing on different machines.
C# Corner. All contents are copyright of their authors.