What is Service Contract in WCF?

Service Contract in WCF

Contracts in WCF are very important. Contracts are responsible for how to communicate, what protocol to use and what message to send.

Following contracts available in WCF:

  • Service Contract
  • Operation Contract
  • Data Contract
  • Message Contract
  • Fault Contract

We will see all contract one by one with the help of practical implementation in C# code.
Let’s start with Service Contract.

Service Contract: Service Contract is nothing but the interface. Service Contract contains the operation that WCF service will have. A WCF service can have more than one Service Contract but must have at least one Service Contract.

A simple Service Contract will look like this.

public interface ICalculate
   //Operation Contract

Related blogs to WCF Service-


Leave a Comment