Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

WCF NetTcp Binding

, 28 Jan 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Optimize Your WCF Performance By NETTCP BindingCodeProject 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 def

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

  • 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.


Useful posts to learn more about NetTcp Binding and its advantages:
http://blog.shutupandcode.net/?p=1085

http://www.codetails.com/punitganshani/optimizing-performance-of-your-wcf-services/20121030

NetTCP Binding Configurations

<system.serviceModel>
<services>
<service name="MyServiceNamespace.SSM">
<endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="MyServiceNamespace.ISSM"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="ultra"
     maxBufferPoolSize="2147483647"
     maxBufferSize="2147483647"
     maxConnections="2147483647"
     maxReceivedMessageSize="2147483647"
     portSharingEnabled="false"
     transactionFlow="false"
     listenBacklog="2147483647">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

Deployment Steps

Step 1

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' .

Step 2

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.

Step 3

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.

Step 4

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.

Step 4.5

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.

Step 5

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.

Conclusion

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Kashif Akhter
Team Leader
Pakistan Pakistan
A computer software development professional with a proven track record of extensive experience of enterprise software development and building the manageable, scalable, and robust enterprise software architectures.
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
QuestionEfficeny Pinmemberdommy1A3-Feb-14 5:51 
AnswerRe: Efficeny PinprofessionalKashif Akhter3-Feb-14 9:18 
GeneralRe: Efficeny Pinmemberdommy1A4-Feb-14 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 Jan 2014
Article Copyright 2014 by Kashif Akhter
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid