The ABCs of WCF Service

 

WCF service consists of three main elements. Those are Address, Binding and Contract. WCF services and its clients communicate each other by agreeing these three elements. In short we call Address, Binding and Contract as ABCs of WCF service.

Address: Address is basically the location of WCF service. That means it represents address of the hosted server. This is represented by using System.Uri type in code. The value of the Address is mentioned in .config file. A WCF service can contain any number of distinct addresses. 

Example: 

http://localhost:8001 

http://localhost:8001/MyService

 

Binding: In WCF Binding defines how client can communicate with the WCF service. There are many bindings which defines different ways to communicate with the WCF service. 

Examples of WCF Bindings are Basic binding, TCP binding, IPC binding, Web Service (WS) binding and MSMQ binding.

 

Contract: In WCF, Contract is a platform-neutral and standard way of describing what the service does. It defines what each method of particular WCF service does.

 

Examples of WCF Contracts are Service Contract, Data Contract, Fault Contracts, and Message Contracts….etc.