If we are going to develop a WCF service that will be consumed by non-WCF client applications, then we can expose our service using BasicHttpBinding or WsHttpBinding. So, how these two bindings differ from each other is explain as:
1) BasicHttpBindingis designed to replaceASMX Web services. It supports both HTTP and Secure HTTP. As far as encodingis concerned, it provides support for Text as well asMTOM encoding methods.BasicHttpBinding doesn’t supportWS-* standards like WS-Addressing, WS-Security andWS-ReliableMessaging.
Note: For further details on Message Exchange Patterns, you can refer my other article “WCF Service -Top 10 Interview Questions” which explainsMEPs in details.
4) WsFederationHttpBinding is a specialized form of WS Binding that offers support for federated security.
Single Computer Scenario:
If our WCF service resides on a single computer, then netNamedPipeBinding will be the best choice.
5) NetNamedPipeBinding is secure and reliable binding on a single WCF computer across process communication. It provides support for binary encoding which is the best choice in this scenario and uses named pipes as transport for SOAP messages.
Intranet/Cross Computers .NET Communication Scenario:
If we need to communicate across computers with same .NET technology on intranet, then netTcpBinding or netPeerTcpBinding options are available. It’s basically the replacement or enhancement of earlier .NET Remoting technology.
6) NetTcpBinding supports reliability, transactions and security. It also supports TCP protocol and binary as encoding method. We can say that it’s the most optimized or fastest binding because both client and service are on the same WCF technology.
7) NetPeerTcpBinding supports features as that of netTcpBinding but it provides secure binding for peer-to-peer environment with WCF Services.
Disconnected Queued Scenario:
8) NetMsmqBinding is required in a cross machine environment with secure and reliable queued communication. This uses MSMQ as transport.
Other Related Articles:
Top 10 Interview Questions and Answers Series:
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions
- Top 10 ASP.NET AJAX Interview Questions