Wednesday, January 1, 2014


Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF we can build secure, reliable, transacted solutions that integrate across platforms.
WCF is a unified framework which provides :

1. NET Remoting 2.Distributed Transactions 3.Message Queues and 4.Web Services into a single service-oriented programming model for distributed computing.
WCF interoperate between WCF-based applications and any other processes that communicate via SOAP (Simple Object Access Protocol) messages.
Features of WCF
Service Orientation
Multiple Message Patterns
Service Metadata
Data Contracts
Multiple Transports and Encodings
Reliable and Queued Messages
Durable Messages
AJAX and REST Support
To know more about features of WCF see:
Terms of WCF

A WCF service is exposed to the outside world as a collection of endpoints.
1. Endpoint: Endpoint is a construct at which messages are sent or received (or both). Endpoint comprises of ABC’s      
What are ABC’s of WCF ?
A. Address - Address is a location that defines where messages can be sent.
B. Binding - Binding is a specification of the communication mechanism (a binding) that described how messages should be sent.
C. Contract - Contract is a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.
2. Service: A construct that exposes one or more endpoints, with each endpoint exposing one or more service operations.
3. Contracts: A contract is an agreement between two or more parties for common understanding and it is a platform-neutral and standard way of describing what the service does. In WCF, all services expose contracts.
Types of Contracts:
1) Operation Contract: An operation contract defines the parameters and return type of an operation.

double Add(double i, double j);
2) Service Contract: Ties together multiple related operations contracts into a single functional unit.

[ServiceContract] //System.ServiceModel
public interface IMath
    double Add(double i, double j);
    double Sub(double i, double j);
    Complex AddComplexNo(Complex i, Complex j);
    Complex SubComplexNo(Complex i, Complex j);
3) Data Contract: The descriptions in metadata of the data types that a service uses.

// Use a data contract
[DataContract] //using System.Runtime.Serialization
public class Complex
    private int real;
    private int imaginary;

    public int Real { get; set; }

    public int Imaginary { get; set; }

No comments: