The ABC of Windows Communication Foundation

Posted By : Bipul Kumar Tiwari

"ABC" is the key to understanding how a WCF service endpoint is composed. It is the three building block of WCF, they are known as

"A" (Address) : Where is the service? (define location of your service)
"B" (Binding) : How do I talk to the service? (how can you services access.)
"C" (Contract) : What can the service do for me?(specific interface between the client or the server.)


The address uniquely identifies the endpoint and tells potential consumers of the service where it is located. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service. It is represented in the WCF object model by the “EndpointAddress” class. An EndpointAddress class contains:

  • A URI property, which represents the address of the service.
  • An Identity property, which represents the security identity of the service and a collection of optional message headers. The optional message headers are used to provide additional and more detailed addressing information to identify or interact with the endpoint.

WCF supports following transport schemas

1) HTTP Address

HTTP addresses use http for transport, and can also use https (Secure ) for secure transport.

Ex: http://localhost:8001/Service

2) TCP Address

TCP addresses use net.tcp for the transport.When a port number is not specified, the TCP address defaults to port 808. It is high performance communication in WCF. Good for internet scenarios.

Ex: net.tcp://localhost:8001/Service

3) Peer Network Adress

Peer network addresses use net.p2p for transport, to indicate the use of the Windows peer networktransport. You must specify the peer network name as well as a unique path and port.

Ex: net.p2p://localhost/

3) Peer Network Adress

Peer network addresses use net.p2p for transport, to indicate the use of the Windows peer networktransport. You must specify the peer network name as well as a unique path and port.

Ex: net.p2p://localhost/

4) IPC(Inter Process communication) or Named Pipes Address

IPC addresses use net.pipe for transport, to indicate the use of the Windows named pipe mechanism. In WCF, services that use named pipes can only accept calls from the same machine. Only open a named pipe once per machine, and therefore it is not possible for two named pipe addresses to share a pipe name on the same machine .It is fast and reliable communication between client and server running on the same machine.

Ex: net.pipe://localhost/Service

5)MSMQ Adress

MSMQ addresses use net.msmq for transport, to indicate the use of the Microsoft Message Queue (MSMQ). You must specify the queue name. When you're dealing with private queues, you must specify the queue type, but that can be omitted for public queues. Used when the client enqueues a message that a service can then consume later

Ex: net.msmq://localhost


Binding Specifies how the two parties will communicate in terms of transport (HTTP, TCP, NamedPipe, Peer2Peer and MSMQ), encoding (text, binary etc.) and protocols (like transactional support or reliable messaging). WCF supports following Binding.

1) Basic binding

Offered by the BasicHttpBinding class. It is Basic Web service communication. There are No security by default in this binding.

2) TCP binding

Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It Supports duplex contracts and transactions

3) Peer network binding

Offered by the NetPeerTcpBinding class, this uses peer networking as a transport.

4) IPC binding

Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.

5) Web Service (WS) binding

Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.

6) Federated WS binding

Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.

7) Duplex WS binding

Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.

8)MSMQ binding

Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.

9)MSMQ integration binding

Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.


In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts.

1)Service contracts:

Describe which operations the client can perform on the service.
interface IFirstContract
string MyAdd( );

2)Data contracts:

Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but you can easily define explicit opt-in data contracts for custom types.

struct Contact
public string FirstName;
public string LastName;

3)Fault contracts:

Define which errors are raised by the service, and how the service handles and propagates errors to its clients.

interface IFirstContract
double MyAdd(double number1,double number2);

4)Message contracts:

Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format you have to comply with. As a WCF developer, you should use message contracts only rarely, so this book makes no use of message contracts.

public class BankingTransaction
[MessageHeader] public Operation operation;
[MessageHeader] public DateTime transactionDate;
[MessageBodyMember] private Account sourceAccount;
[MessageBodyMember] private Account targetAccount;
[MessageBodyMember] public int amount;

Related Articles


About the Author

Its me BIPUL who is logically minded creative at heart , a good communicator , a self taught full stack developer. I constantly focuses on my thinking , reading , collecting and creating my work in a order to enhance my skills.

I discover new dimensions for growing bussiness with a proven record in creating database and programming. I have a strong technical skills as well as strong interpersonal skills. Read more...

Browse By Category

Popular Articles