user2783193
user2783193

Reputation: 1012

WCF Bindings, when to use what

one simple question WCF service is running and it can be consumed either over Internet or lan network. Since both scenarios support http obviously I should use only httpBasicBinding. Can someone explain me when other types of binding should occur?

Upvotes: 1

Views: 499

Answers (2)

Abhinay
Abhinay

Reputation: 348

NetTcp Binding : this can be used across lan but no outside the lan network, outside lan you can use only http. Also consider this binding when you access your service within the lan as the performance of NetTcp is better than http.

NetNamedPipe Binding: this can be used only in the same machine, this is much faster than NetTcp but limited access to only same machine.You can use this incase you are using routing for your wcf service, you can expose service uri as http and routing uri as netpipe in the same machine.

NetPeerTcpBinding: Communication between computers across peer-to-peer services. Supports duplex contracts.

NetMsmqBinding: Communication between WCF applications by using queuing. Supports transactions.

WSHttpBinding: Web services with WS-* support. Supports transactions and reliable messaging.

WSDualHttpBinding: Web services with duplex contract and transaction support.

Apart from the default bindings provided, you can also have provision to create custom binding.

Upvotes: 1

Svenisok
Svenisok

Reputation: 446

BasicHttpBinding is more lightweight and consumes less bandwith (less overhead) then other types of Bindings.

WsHttpBinding also supports interoperability. With this binding, the SOAP message is, by default, encrypted. It supports HTTP and HTTPS. In terms of encoding, it provides support for Text as well as MTOM encoding methods. It supports WS-* standards like WS-Addressing, WS-Security and WS-ReliableMessaging. By default, reliable sessions are disabled because it can cause a bit of performance overhead.

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.

You can find more about bindings in this post on codeplex: http://www.codeproject.com/Articles/431291/WCF-Services-Choosing-the-appropriate-WCF-binding

Upvotes: 8

Related Questions