Simple WCF Binding Configuration example

In the previous post we moved the config code into a App.config file. Now let’s configure the bindings for the EchoService. A WCF binding for a Service Endpoint, combines the transport protocol (MSMQ, HTTP, TCP…), message format (JSON, XML, MTOM…) and message protocol (none, WS, SOAP…). WCF ships with the most common binding scenarios and a CustomBinding for creating your own binding. Here’s an overview of the most common configuration elements.

Configuration Element Description


Basic SOAP like ASP.NET Web services (ASMX)-based services.


Full fledged SOAP and WS protocols


Named Pipes. A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.


MSMQ. A queued binding that is suitable for cross-machine communication between WCF applications.


TCP peer-to-peer. Secure, multi-machine communication.


RESTful web service.

The configuration example of the EchoService sets the BasicHttpSecurityMode to Transport. This sends all service communication over SSL/HTTPS, so the service need some kind of SSL certificate (not shown here).

<?xml version="1.0" encoding="utf-8"?>
        <binding name="BasicHttpBindingConfig">
          <security mode="Transport">
            <transport clientCredentialType="Certificate" />
        <behavior name="BehaviourMetaData">
          <serviceMetadata httpGetEnabled="true" />
      <service behaviorConfiguration="BehaviourMetaData" 
        <endpoint address="http://localhost:8080/EchoService" 
                  bindingConfiguration="BasicHttpBindingConfig" />

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>