Contract is a platform-neutral and it describes what the service does. Mainly there are four types of contracts available in WCF.
- Service Contract
- Data Contract
- Message Contract
- Fault contract
1. Service Contract:
Service contracts describe the operation that service can provide.
2. Data Contract:
Data contract describes the custom data type which is exposed to the client.
3. Message Contract:
The SOAP message format is provided by the WCF runtime for communication between Client and service. If it is not meeting your requirements then we can create our own message format. This can be achieved by using Message Contract attribute.
4. Fault Contract:
The Fault Contract provides documented view for error occurred in the service to client. This helps us to easy identity, what error has occurred.