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.
[ServiceContract]
public interface ICalculate
{
//Operation Contract
}
Related blogs to WCF Service-
- Introduction to WCF
- ABC of WCF
- Basics of WCF Architecture
- WCF vs Web Service
- What is XML serialization?
- WCF Binding
- Create first WCF application
- Fault Contract in
- WCF Data Contract vs Message Contract
- Message Contract
- Data Contract Serialization and De-Serialization
- Data Contract in WCF
- Operation Contract in WCF
- Service Contract in WCF
- How to host a WCF service in IIS?
- WAS Hosting in WCF
- Self Hosting in WCF
- How to create WCF RESTful Service.