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.
using System;
namespace ConsoleApplication10
{
class Program
static void Main(string[] args)
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
string result = proxy.GetDataUsingnetTcpBinding(99999);
Console.WriteLine(result);
Console.ReadKey(true);
}
} 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.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: