Binding says , how the service could be used. Binding specifies
- Which protocol to be used
- Which encoding to be used.
- What type of security requeiremnet to be used like SSL or SOAP message security.
System provided Bindings
basicHttpBinding
basicHttpBinding
- This is interoperable binding.
- This is commonly used as replacement for earler web service based on ASMX.
- It supports HTTP & HTTPS protocols.
- It supports MTOM encoding.
- It supports text encoding.
wsHttpBinding
- This is a secure binding.
- This is interoperable binding.
- This uses SOAP over HTTP.
- This supports reliability over Internet.
- This supports transaction over Internet.
- This supports security over Internet.
- This supports HTTP/HTTPS proptcol
- This supports text and MTOM encoding.
- This is default binding provided by WCF.
wsDualHttpBinding
- This supports all the feature of wsHttpBinding.
- This is mainly used for DUPLEX SERVICE CONTRACTS.
- This supports bidirectional communication.
webHttpBinding
- This is a secure binding.
- This is a interoperable binding.
- It supports Http/Https protocol.
- It does not use SOAP message format.
wsFederationHttpBinding
- This is a secure Binding.
- This is interoperable binding.
- This supports federated security
- This supports Https/Https protocols.
- This uses text/MTOM encoding.
netTCPBinding
- This is a secure Binding.
- This could only be used if client is also a WCF machine.
- This is used to send Binary encoded SOAP message from one WCF computer to another.
- This uses TCP (Transimission Control Protocol)
- This supports reliability.
- This supports transaction,
- This supports security.
netNamedPipeBinding
- This is a secure Binding.
- This could be used over a single WCF computer.
- This sends Binary encoded SOAP message over named pipes.
netMSMQBinding
- This is a queued Binding.
- This uses Binary encoded SOAP message.
- This sends message over MSMQ.
- Here communication should occur between two computers.
netPeerTCPBinding
- This is a secure Binding.
- This uses TCP overe peeer to peer.
- Communication should occur between two or more computers.
msmqIntegrationBinding

basicHttpContextBinding
This Binding is same as of basicHttpBinding with more attributes , like below

basicHttpContextBinding
This Binding is same as of basicHttpBinding with more attributes , like below
- It supports HTTP cookies
- It eanble SOAP haeders to excahnge context.
- This binding is mainly used for Durable services.
netTCPContextBinding
This Binding is same as of netTCPBinding with more attributes , like below
This Binding is same as of netTCPBinding with more attributes , like below
- It eanble SOAP haeders to excahnge context.
- This binding is mainly used for Durable services.
wsHttpContextBinding
This Binding is same as of wsHttpBinding with more attributes , like below
This Binding is same as of wsHttpBinding with more attributes , like below
- It eanble SOAP haeders to excahnge context.
- This binding is mainly used for Durable services.
Example :
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<!-- Service Endpoints -->
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">
<!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically.-->
<identity>
<dns value="localhost"/>
</identity></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service></services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<serviceBehaviors>
</behaviors>
</system.serviceModel>
<!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically.-->
<identity>
<dns value="localhost"/>
</identity></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service></services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<serviceBehaviors>
</behaviors>
</system.serviceModel>
Contract of and EndPoint (C)


- Contract should be an Interacfe
- Contract could be a class also but better approach is interface.
- In config file this is preceded by prpject name space name
<endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">

No comments:
Post a Comment