Introduction to Windows Communication Foundation (WCF)

WCF stands for Windows Communication Foundation and is part of .NET 3.0. WCF is a Microsoft platform for building distributed and interoperable applications. WCF supports multiple languages and multiple platforms.

WCF tutorial covered complete topics from basic to advanced level these are: WCF Architecture, WCF Bindings, WCF Addresses, WCF Contracts, WCF Hostings, WCF Endpoints, WCF Client, Side Program, WCF Services, WCF Security and many more topics in WCF.

What is WCF?

Windows Communication Foundation (WCF), earlier known by the name Indigo, is a runtime platform and a set of APIs in the .NET Framework for building, configuring, and deploying Service Oriented Applications.

WCF is deprecated for the purpose of developing modern HTTP-based web services.

Uses of WCF

  • Basically, WCF is used to create a distributed and interoperable application.
  • It can be used to send data as asynchronous messages from one service endpoint to another.
  • It can be used to build RESTful services in .NET.

A Brief History of WCF

WCF is one of the latest technology offered by Microsoft to address SOA and to enable applications in a distributed environment for communication. Its working started with the release of .NET and Microsoft unveiled this offer at the Microsoft Product Developers Conference 2003 in Los Angeles, California.

This technology has taken years to build and come to market. It is the first programming model built from the ground up to provide explicit service-oriented application development and ready-to-face-the-future business orientation.

Fundamentals of WCF


A message is the communication unit in the form of an envelope for the transmission of the data from the client to Service and Service to the client and has two sections: Header, Body.


Endpoint describes the address of Web Service from where a user can receive and send the message by specifying the communication mechanism of how the message will be sent or received.

It consists of three things (A, B, and C) with question marks:

  • Address (Where?)
  • Binding (how?)
  • Contract (What?)

Endpoint = A + B+ C

Address: locates the WCF Service, where the Service is hosted? With the exact URL of Web Service as given-


Binding: Binding is the mechanism by which the user communicates with Web Service. It is the constitution of some elements that bind together and creates the structure of communication such as some transport protocols like HTTP, TCP, etc. including message format or security techniques also.

A contract is the interface name which has all the operation need to be exposed as it specifies what functionality and operation are being provided by the service. It also specifies what functionality and operation need to be exposed to the client.


Hosting makes WCF Application different from other distributed Applications. It consists of the following types:

  • IIS Hosting
  • Self-Hosting
  • WAS Hosting


SOAP (Simple Object Access Protocol) is an XML based message protocol and not a transport protocol.

Features of WCF

These are the following features of WCF:

Service Orientation

WCF enables us to create service-oriented applications. The architecture of WCF is service oriented that makes it a reliance on Web services to send and receive data. WCF services are loosely-coupled from one application to another, implies that any client from any endpoint can connect to any service as long as the essential contracts are met.


WCF implements modern industry standards for Web service interoperability by providing a set of specifications known as web specifications and makes web services interoperable.

Multiple Message Patterns

There are several message patterns in which the messages are exchanged as follows:

  1. The most common pattern is the request/reply pattern in which one endpoint requests data from a second endpoint and get replied by the second endpoint in response.
  2. The second one is a one-way message pattern in which a single endpoint sends a message without any expectation of any response.
  3. The third one is the more complex pattern known as the duplex exchange pattern in which the two endpoints make a connection and send data back and forth manner similar to an instant messaging program.

Service Metadata

WCF supports service metadata (set of data about other data) to get published over HTTP and HTTPS by using formats specified in industry standards such as WSDL, XML Schema and WS-Policy, in use to generate and configure clients for accessing its services automatically.

Data Contracts

As WCF built by using .NET Framework, it includes code-friendly methods of supplying the contracts to enforce such as data contract, one of the universal types of contract. If you code your service using Visual C# or Visual Basic, you will get the easiest way to handle data by creating classes that represent a data entity with properties that belong to the data entity. You get a comprehensive system for working with data in this secure manner.

Your service will automatically generate the metadata and allows clients to comply with the data types you have designed with the help of classes to represent data.


Messages encryption can be done for privacy concern and you can require users to authenticate themselves before being allowed to receive messages. Security concern can be implemented by using well-known standards such as SSL or WS-SecureConversation.

Reliable and Queued Messages

WCF has reliable sessions implemented over WS-Reliable Messaging and MSMQ to support reliable message exchange.


WCF supports the transactions with the help of these three transaction models:

  1. WS-AtomicTtransactions
  2. System.Transactions namespace
  3. Microsoft Distributed Transaction Coordinator


WCF architecture has a number of extensible points such that if any user requires extra capability, it opens a number of entry points to customize the behavior of a service.

Advantages of WCF

The advantages of WCF include:

  • WCF can be configured to work independently of SOAP or RSS.
  • WCF offers excellent performance compared to other Microsoft specifications as it is one of the fastest communication technologies.
  • WCF is secure and reliable in comparison with web services or ASMX services as it has a service-oriented architecture for the message exchange.
  • WCF supports Scaling/Load Balancing.
  • WCF provides reliability, security and transaction management by using WS specifications.
  • WCF complements Web Services and distributed applications and enhances their values.

Disadvantages of WCF

  • Being implemented as SOA by Microsoft, WCF APIs are solely controlled by MS that makes interoperability a bit difficult.
  • To deploy WCF apps, the user needs more underlying hardware resources on the platform to run WCF applications.


Pin It on Pinterest

Share This