- Welcome all,
lets go through WCF basics with some practical examples.
- Windows Communication Foundation (WCF) is a dedicated communication framework provided by Microsoft. WCF is a part of .NET 3.0.
- The runtime environment provided by the WCF enables us to expose our CLR types as services and to consume other existing services as CLR types.
ABC’s of WCF :
- Address: WCF services must have an address. The address specifies the location of the service which will be exposed for clients that will use it to communicate with the service. The address’s protocol that WCF can provided: HTTP , TCP ,NamedPipe , Peer2Peer ,MSMQ.
- Binding: Specifies how a service is accessible. In other words: how the two parties will communicate in terms of transport (HTTP , TCP ,NamedPipe , Peer2Peer ,MSMQ) ,encoding (text, binary etc.) and protocols (like transactional support or reliable messaging).
- Contract: Used to specify what your service can do. For example: give you the square when providing 2 numbers.
- Endpoints: All communications with the WCF service will happen via the endpoints. The endpoints specify a Contract that defines which methods of the Service class will be accessible via the endpoint; each endpoint may expose a different set of methods. The endpoints also define a binding that specifies how a client will communicate with the service and the address where the endpoint is hosted. WCF provides Windows Activation Services which can be used to host the WCF service. Otherwise the WCF service can also be hosted in IIS or in any process by using the Service Host class, which is provided by WCF. Services can also be self-hosted.
Useful Links :