Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF - when should i use netTcpBinding

Tags:

c#

wcf

i usually use HTTP binding at my services.
i read that net.tcp Binding works faster, however i am not quite sure on when should i use it?
what is the best practice, are there any drawbacks?

thanks

like image 788
Shay N. Avatar asked Oct 06 '13 18:10

Shay N.


1 Answers

The MSDN page for NetTcpBinding says it best

The default configuration for the NetTcpBinding is faster than the configuration provided by the WSHttpBinding, but it is intended only for WCF-to-WCF communication.

So NetTcpBinding is good to use when you have a .NET WCF client and a .NET WCF server, however if you need to support clients that are not written in .NET WCF (for example you are publishing a public service and you don't know what language the client will be written in) then you need to use a HttpBinding instead.

This page has a good quick summary of each type of binding and when they should be used.

  • BasicHttpBinding - A binding that is suitable for communicating with WS-Basic Profile conformant Web services, for example, ASP.NET Web services (ASMX)-based services. This binding uses HTTP as the transport and text/XML as the default message encoding.
  • WSHttpBinding - A secure and interoperable binding that is suitable for non-duplex service contracts.
  • WS2007HttpBinding - A secure and interoperable binding that provides support for the correct versions of the Security, ReliableSession, and TransactionFlow binding elements.
  • WSDualHttpBinding - A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
  • WSFederationHttpBinding - A secure and interoperable binding that supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users.
  • WS2007FederationHttpBinding - A secure and interoperable binding that derives from WS2007HttpBinding and supports federated security.
  • NetTcpBinding - A secure and optimized binding suitable for cross-machine communication between WCF applications.
  • NetNamedPipeBinding - A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.
  • NetMsmqBinding - A queued binding that is suitable for cross-machine communication between WCF applications.
  • NetPeerTcpBinding - A binding that enables secure, multi-machine communication.
  • WebHttpBinding - A binding used to configure endpoints for WCF Web services that are exposed through HTTP requests instead of SOAP messages.
  • MsmqIntegrationBinding - A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing (also known as MSMQ) applications.
like image 88
Scott Chamberlain Avatar answered Sep 20 '22 10:09

Scott Chamberlain