WCF Service Binding determines how a Client or rather a Consumer of the WCF service is going to communicate with it. There are many bindings available. Mostly used ones are –
- Custom Binding
This post talks about Custom Binding and how it can be implemented to support SOAP 1.2 standards. Please note that WSHTTPBinding supports SOAP 1.2 by default. However, some firms find security-related issues with using this binding. The WS-Addressing functionality is enabled for this binding which cannot be changed.
Let us first look at the Web.config settings required to implement CustomBinding –
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport requireClientCertificate="True" />
<service behaviorConfiguration="BehaviorName" name="ServiceName">
<endpoint address="" binding="customBinding" bindingConfiguration="BindingName" contract="ServiceInterfaceName" />
<behavior name=" BehaviorName">
<serviceMetadata httpsGetEnabled="true" />
Please make note of the following values specified in the above configuration –
- BehaviorName – Denotes the service behavior configuration to be used for the WCF service. Here, it allows HTTPS request (required for service hosted on HTTPS).
- ServiceName – Denotes the name of your WCF service
- BindingName – Denotes the name you give to your binding configuration
- ServiceInterfaceName – Denotes the name of the Interface class or the contract of your WCF service.
In one of my posts, I had created the client programmatically using C#, the above configuration settings correspond to the same code used but the initialization part is done at the Client’s end.