Windows Communication Foundation. A framework that brings together the long story of ASMX / WSE, .Net Remoting, DCOM/COM+/ES and MSMQ.

In a simpler WebApi OWIN world this technology is sort of being left behind. But I think it’s important to keep it in mind.

WCF is Microsofts major provider of service oriented programming model. Or, at least, it used to be and lots of larger organisations are still choosing to use it.

What’s a Node?

The players. The various servers and clients involved. Each distributed component is a node.

Transport Mechanisms

A transport mechanism describes the sort of data and the way the data is read by services and clients.

Various communication styles include; SOAP on MSMQ using XML, Distributed Objects on TCP using Binary and Restful on Http using Rss or Json.


Each end point defines a different communication option. One service can have many endpoints that define a different transport mechanism. With configuration!


A network address. where to send the message. An address that indicates where the endpoint can be found.


How to send messages. ws* protocols. A binding that specifies how a client can communicate with the endpoint.

A recipe for how WCF will build the underlying communication channel.


A contract identifies the operations available.


A set of behaviors that specify local implementation details of the endpoint.

WCF Attributes


A data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged.

Data Members

Specifies that the member is part of a data contract.


The service contract specifies what operations the service supports.


Indicates that a method defines an operation that is part of a service contract.

Files & References.


ServiceContract & OperationContract WCF Interface components.


DataContract & DataMember object serialisation.


Configure what services are being hosted and the available endpoints for each service.

What’s the difference between WSHttpBindings and BasicHttpBindings?

If we want to summarize in one sentence, the difference between WsHttpBinding and BasicHttpBinding is that WsHttpBinding supports WS-* specification. WS-* specifications are nothing but standards to extend web service capabilities.

An example WSHttpBinding message.

<s:Envelope xmlns:a="" xmlns:s="">
    <a:Action s:mustUnderstand="1"></a:Action>
    <SayHello xmlns="">
      <name xmlns:d4p1="" xmlns:i="">
        <d4p1:First i:nil="true" />
        <d4p1:Last i:nil="true" />

An example BasicHttpBinding message.

<s:Envelope xmlns:s="">
    <Action s:mustUnderstand="1" xmlns=""></Action>
    <SayHello xmlns="">
      <name xmlns:d4p1="" xmlns:i="">
        <d4p1:First i:nil="true" />
        <d4p1:Last i:nil="true" />


RESTful via HTTP.


SOAP via HTTP and limited WS* protocols.


SOAP via HTTP with full SOAP and WS* compliance.


Cross-machine communication via TCP. Binary across the wire.


Cross-machine communication via P2P. Binary across the wire.


Cross-machine communication via IPC. Binary across the wire.


Disconnected Asyncronous communication via MSMQ. Binary across the wire.

How does a client create a channel?

  1. Find a service.
  2. Retrieve the endpoint information. Via a WSDL file.
  3. Import meta data with references to available endpoints.
  4. Create a channel for a given endpoint.

Now, with that channel the client can now submit a message to the service.

Setting the WCF Test Client

Interesting. By default the prebuild WCF Test Client application works great. To use a homegrown console app just update the startup options to link to your console app instead! Hit F5 of your wcf service and watch you exe file kick off :)