WCF (1), Basics

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
      •  Address
      • Binding
      • Contract
  •  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).
Graph Borrowed from
 
Problem

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). 
Graph Borrowed from
 
Solution: WCF

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?)
 
Address
 
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.
 
 
Bindiing 
 
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,
 
 
Note 
We will discuss more details for Bindings, and Channel in the article: WCF (3), Bindings and Channel Stack.
 
Contract
 
Contract is what functionality and operation is being provided by  the service (we will discuss more details in the article WCF (2), Contracts in Various Types).
 
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

 
In this article, we discussed WCF the basic and fundamental features, such as What WCF is, Why WCF,  major features. We will discuss more details for Bindings and Channel Stack, and Contracts in following articles WCF (3), Bindings and Channel Stack and WCF (2), Contracts in Various Types, respectively.
 
References


Similar Articles