Binding in WCF

This blog defines binding in WCF.

Introduction

WCF provides a bunch of diffrent bindings which will hopefully allow you to develop your service without having to go through much code. Patterns and Commmands used over and over by developers have been brought together, which allows you to get the 'standard' services into production fast. If you have different needs, you can still develop a custom binding with minimal fuss, but you need to know what is out there to see if there is already a binding that will fit your needs.

Bindings that are prefixed with 'net' mean they were designed to take advantage of .NET and perform many performance- enhancing operations. Bindings that are prefixed with 'ws' are to be used with all systems and conform to set web standards. A brief discussion of the currently available standard bindings is available as follows,

Types of Binding

Let us see more detailed on predefined binding

BasicHttpBinding

It is suitable for communicating with ASP.NET Web services (ASMX)-based services that comfort with WS-Basic Profile conformant Web services. This binding uses HTTP as the transport and text/XML as the default message encoding. Security is disabled by default This binding does not support WS-* functionalities like WS- Addressing, WS-Security, WS-ReliableMessaging. It is fairly weak on interoperability.

WSHttpBinding

Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts. It offers lot more functionality in the area of interoperability. It supports WS-* functionality and distributed transactions with reliable and secure sessions using SOAP security. It uses HTTP and HTTPS transport for communication. Reliable sessions are disabled by default.

WSDualHttpBinding

This binding is same as that of WSHttpBinding, except it supports duplex service. Duplex service is a service which uses duplex message pattern, which allows service to communicate with client via callback. In WSDualHttpBinding reliable sessions are enabled by default. It also supports communication via SOAP intermediaries.

WSFederationHttpBinding

This binding support federated security. It helps implementing federation which is the ability to flow and share identities across multiple enterprises or trust domains for authentication and authorization. It supports WS-Federation protocol. To be used for advanced WS-based web services using federated identity.

NetTcpBinding

This binding provides secure and reliable binding environment for .Net to .Net cross machine communication. By default it creates communication stack using WS-ReliableMessaging protocol for reliability, TCP for message delivery and windows security for message and authentication at run time. It uses TCP protocol and provides support for security, transaction and reliability.

NetNamedPipeBinding

This binding provides secure and reliable binding environment for on-machine cross process communication. It uses NamedPipe protocol and provides full support for SOAP security, transaction and reliability. By default it creates communication stack with WS-ReliableMessaging for reliability, transport security for transfer security, named pipes for message delivery and binary encoding. This is optimized for on machine communication.

NetMsmqBinding

This binding provides secure and reliable queued communication for cross-machine environment. Queuing is provided by using MSMQ as transport. It enables for disconnected operations, failure isolation and load leveling. Binding for asynchronous communication using MSMQ(Microsoft Message Queue)

NetPeerTcpBinding

This binding provides secure binding for peer-to-peer environment and network applications. It uses TCP protocol for communication It provides full support for SOAP security, transaction and reliability.

msmqIntegrationBinding

This binding allows WCF developers to communicate with existing systems that communicate via MSMQ.

webHttpBinding

This allows you to expose your services as Http requests as used for REST-based services to output XML or JSON.