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.
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
What about webHttpBinding?
Hi momo,
webHttpBinding is used for REST-based Services. As opposite to WCF SOAP-based services, REST uses HTTP for making calls instead of using it as just a transport. See attachment for usage of webHttpBinding in configuration.
To further understand about it and a complete practical example for creating your first REST-based WCF Service in 5 simple steps, please follow the link below:
http://www.topwcftutorials.net/2013/09/simple-steps-for-restful-service.html
When is use WSDuaBinding?
If you mean WSDualHttpBinding, I have mentioned above that “WsDualHttpBinding has all features of WsHttpBinding with addition that it supports Duplex MEP – Message Exchange Pattern” meaning both service and client send and receive messages.
For details on Duplex MEP , please follow here:
http://www.topwcftutorials.net/2014/09/message-exchange-patterns-wcf.html
Really useful!!!! Thanks for all your effort
Very Usefull article. thank you so much for your effort. all the success for future articles.
I was very pleased to find this site. I wanted to thank you for this unique read. I definitely savoured all bits and pieces of it including all the comments and I have added you to my bookmark list to check out new articles you post.
Outdoor Furniture