ABC of WCF

In this article, we will focus on ABC of WCF which is the core of WCF service endpoints.

This is one of the most important interview questions.

What is the ABC of WCF? 

ABC is the main foundation of WCF learning. WCF service comes into existence with a valid Endpoint.  An endpoint consists of 3 major components.

We generally refer to these components as ABC in WCF Service.

  • A- Address (Where)
  • B- Binding (How)
  • C- Contract (What)

Address

Here A stands for Address. An address is a URL which tells where exactly the service is hosted. We can also refer to it as the location of the WCF service. The location could be an IP address, server name or any valid URL.

Binding


B for Binding and it describes how a client will communicate with WCF service. It defines the protocol for how to communicate. WCF supports various protocols like HTTP, TCP, MSMQ, and Named Pipes. Binding tells what protocol will be used to communicate.

Contract

Finally, C stands for Contract, which tells what an endpoint will communicate and the client will be aware of the operations that were exposed. It is a contract between the client and server which includes message content, message structure etc. It is also responsible for operations and data types of WCF services.

Some of the contracts are Service Contracts, Data Contracts, Message Contracts and Fault Contracts. Here, each contract has its specific task and responsibility.

Below is an example of ABC in WCF.

<endpoint address="<Service URL>" contract="ITestService"
          binding="wsHttpBinding"/>

So, together these three components form endpoints:

Endpoint = Address + Binding + Contract

Please note that a WCF service may have multiple endpoints and may have different addresses, binding and contracts.

Hope you are now familiar with ABC of WCF services.

In the next blog, We will learn about various types of Bindings in WCF

Related blogs to WCF Service-

Leave a Comment

RSS
YouTube
YouTube
Instagram