In this series of articles, we will discuss the major features of WCF:
Introduction
We will discuss WCF major features in the following order:
- What: WCF
- WCF Service
- WCF Host
- WCF Client
- Why: WCF
- WCF = Webservice + .Net remoting + MSMQ + COM+
- Fundamentals of WCF
- EndPoint of WCF: A + B + C
- Hosting
- Self Hosting
- IIS
- WAS hosting (Windows Process Activation Service)
A: What WCF is
Windows Communication Foundation (WCF) is a framework for building
service-oriented applications to send data as
asynchronous messages from one service endpoint to another, where
- Service
endpoint --- hosted by IIS,
or in an application.
- Client endpoint --- to requests data from a service endpoint.
- Messages --- can be as simple as a single character or word sent as XML, or
as complex as a stream of binary data.
WCF is basically used to create a distributed and interoperable Application. WCF Applications came into the picture in .Net 3.0 Framework. It includes three parts:
- WCF Service : What is the service and what it is providing.
- WCF Service Host: Where is the Service hosted.
- WCF Service Client: Who is the client of the Service.
B: Why WCF
Why we need WCF Applications
Suppose, you have two clients- one wants to use a Web Service, which sends data over the network, using Http protocol and want reply in XML format, so we will create a Web Service.
The other wants to send the data, using Web Service over the network, using TCP protocol and replying in binary format, then we need to implement a remote Web service with TCP protocol (the following graph shows the situation).
For this situation, we need to create two different Services for two different clients, while using WCF will solve this problem with one single service consumed by two different clients- either they want same protocol or a different protocol. We specify the protocol name in an endpoint attribute of the Web Service (the following graph shows the WCF solution).
WCF unites all the technologies under one umbrella:
WCF =
Webservice + .Net remoting + MSMQ + COM+
C: Fundamentals of WCF
EndPoints
Endpoints: Addresses, Bindings, and Contracts
All communication with a WCF service occurs through the endpointsof the service. Endpoints provide clients access to the functionality offered by a WCF service that includes three parts (Endpoints = A + B+ C):
- Addresses (Where?)
- Bindings (how?)
- Contracts (What?)
the address of WCF Service, where the Service is hosted? It gives the exact URL of Web Service, where the Service hosts the pattern of URL, which is-
Scheme://domain/[:port]/path
net.tcp://localhost:1234/MyService
http://localhost:1234/MyService
The preceding is the format of an address. Whereas the first part is the
transport schema, the
second part is the server location.
It
describes the way or mechanism by which the user will communicate with WCF
Service. It constitutes some binding element, which creates the structure of
communication such as some transport protocols like HTTP, TCP etc. Message
format or security techniques etc.
Following the decision diagram to choose a binding,
Hosting
WCF supports following types of hosting-
- IIS Hosting
- Self hosting
- WAS hosting (Windows Process Activation Service)
Following the decision diagram to choose a hosting,
Summary