An Overview of Windows Communication Foundation

An Overview of Windows Communication Foundation

What is WCF?

WCF stands for Windows Communication Foundation and its code name is “indigo”. WCF is released as part of .NET Framework 3.0 and it is a framework for building, deploying interoperable distributed services and configuring. It also provides built-in support for logging. You can also enable and disable logging using configuration. WCF services are not tightly bound to a protocol. At the time of designing of WCF services, we do not have to worry about any protocol. It supports many transport schemes

  • IPC
  • TCP
  • Peer Network
  • Service Bus
  • MSMQ

It is the progressive version of Web Service. WCF Services endpoints must have three things i.e. Address tells us where the WCF service is hosted, Binding decides the protocol of the service and Contract defines what services operations are available to the client to use.


WCF Supports several types of Contract such as



          It uses which service is exposed to the client. We use it with the interfaces or class


          It is used which operation can perform by the client, it uses for class methods.


          It used to explain which data types are going to get and set the service.


          It interacts directly through messages.


          It handles with errors

Example code of the uses of Contracts in WCF





        Student GetStudent(int Id);



        void SetStudent(Student student);



WCF hosting needs to be hosted on a windows process named host process. Single host can host multiple services and it can be hosted in many ways such as

  • IIS
  • WAS Hosting
  • Custom Hosting in IIS
  • Windows Server AppFabric
  • Self-Hosting

Example of Self Hosting

using (ServiceHost host = newServiceHost(typeof(StudentService.StudentService)))



                Console.WriteLine("Host started At " + DateTime.Now.ToString());