NetTcp binding is based on Transmission Control Protocol. This is most efficient binding and intended to be used in service to service communication in an intranet environment. The NetTcpBindinggenerates a run-time communication stack by default, which uses transport security, Transmission Control Protocol for message delivery, and a binary message encoding. Use this binding when you want to provide a secure and reliable binding environment for .NET-to-.NET cross-machine communication. NetTcpBinding is the equivalent of .NET Remoting in .NET 3.0, with the advantage that it is easier to code.
On the other hand HttpBinding is based on HTTP protocol. It is compatible with Web Service Technology and SOAP standard, which are heavier than Transmission Control Protocol.
Characteristics And Limitations
It can only be consumed by WCF-enabled clients.
Transport security is turned on by default.
The service can be hosted in IIS 7.0 or later.
It supports the WS* stack, including reliable messaging, message security, and secure transactions.
It Support only intranet environment where the firewall configuration can be controlled
Key Performance Areas
Useful posts to learn more about NetTcp Binding and its advantages:http://blog.shutupandcode.net/?p=1085http://www.codetails.com/punitganshani/optimizing-performance-of-your-wcf-services/20121030
- Increase in throughput of data notifications a client application can receive from the server,
- Allow more clients to be connected concurrently to the server.
- Reduces the Bandwidth utilization.
NetTCP Binding Configurations
<transport protectionLevel="None" clientCredentialType="None"/>
A very first step is to let the IIS support netTcp Binding, by default IIS only supports HTTP or HTTPS to do that, first we need to activate the WCF non-HTTP activation. Go to control panel > Program and Features > Turn Windows features on or off then look for ‘Microsoft .NET Framework 3.5.1′ .
Select both the option under the umbrella of 'Microsft .NET Framework 3.5.1' .
As the Step 1 automatically unregister the ASP.NET. So, you need to register it with IIS again. Go to Visual Studio Command Prompt and type 'aspnet_regiis -i' this command will register the ASP.NET with IIS.
Now check these windows services running. Go to Run > services.msc and look for the highlighted services. Start them if these are in Stopped state.
Now configure IIS to enable a website to use net.tcp port which is 808 by default. You can also change it any other port you want. Make sure you don’t configure net.tcp to port 80 because it is being used by HTTP and you cannot have two protocols running on the same port.
Open IIS and then go to your ‘Default Web Site’ and right click on it and then go to ‘Edit Bindings’. Select net.tcp option from dropdown list.
Now assign the port address to IIS to listen TCP requests. 808 is a default port but you can have any other port as well. Format is ‘port:ipaddress’
I use ’808:*’ and then click ok.
Now enable net.tcp protocol for your application in the IIS. Right click on your application in the IIS and then click on ‘Advanced Settings’ and look for property ‘Enabled Protocols’ and enter ‘net.tcp’. It is comma-seperated list so you can enable multiple protocols by separating them with a comma.
Using netTcp binding helps improve your application performance up to 80%. As I mentioned some links earlier in this post where you can check performance statistics of netTcp binding. Performance is one the considerations of using netTcp binding, there are many more advantages to use this binding such as reliable messaging, port sharing, controlled firewall configuration and cross-machine communication.