Click here to Skip to main content
13,549,303 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


23 bookmarked
Posted 29 Apr 2011
Licenced CPOL

WCF Architecture

, 29 Apr 2011
Rate this:
Please Sign up or sign in to vote.
A brief explanation of the WCF architecture


The following figure illustrates the major components of WCF:



Contracts layer are next to that of Application layer. Developers will directly use this contract to develop the service. We are also going to do the same now. Let us see briefly what these contracts will do for us and we will also know that WCF is working on message system.

Service Contracts

Service contracts describe the operation that service can provide. Example, Service provided to know the temperature of the city based on the zip code. We call this service as Service contract. It will be created using Service and Operational Contract attribute.

Data Contract

It describes the custom data type which is exposed to the client. This defines the data types, and is passed to and from service. Data types like int, string are identified by the client because it is already mention in XML schema definition language document, but custom created class or datatype cannot be identified by the client, e.g., Employee data type. By using DataContract, we can make client aware that we are using Employee data type for returning or passing parameter to the method.

Message Contract

Default 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.

Policies and Binding

Specify conditions required to communicate with a service, e.g., security requirement to communicate with service, protocol and encoding used for binding.

Service Runtime

It contains the behaviors that occur during runtime of service.

  • Throttling Behavior- Controls how many messages are processed
  • Error Behavior - Specifies what occurs, when internal error occurs on the service
  • Metadata Behavior - Tells how and whether metadata is available to outside world
  • Instance Behavior - Specifies how many instances of the service have to be created while running
  • Transaction Behavior - Enables the rollback of transacted operations if a failure occurs
  • Dispatch Behavior - Controls how a message is processed by the WCF Infrastructure


Messaging layer is composed of channels. A channel is a component that processes a message in some way, for example, by authenticating a message. A set of channels is also known as a channel stack. Channels are the core abstraction for sending messages to and receiving messages from an Endpoint. Broadly, we can categories channels as:

Transport Channels

Handle sending and receiving messages from network. Protocols like HTTP, TCP, name pipes and MSMQ.

Protocol Channels

Implement SOAP based protocol by processing and possibly modifying message. E.g. WS-Security and WS-Reliability.

Activation and Hosting

Services can be hosted or executed, so that it will be available to everyone accessing from the client. WCF service can be hosted by the following mechanisms:


Internet information Service provides number of advantages if a Service uses Http as protocol. It does not require Host code to activate the service, it automatically activates service code.

Windows Activation Service

(WAS) is the new process activation mechanism that ships with IIS 7.0. In addition to HTTP based communication, WCF can also use WAS to provide message-based activation over other protocols, such as TCP and named pipes.


WCF service can be self hosted as console application, WinForms or WPF application with graphical UI.

Windows Service

WCF can also be hosted as a Windows Service, so that it is under the control of the Service Control Manager (SCM).


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
rnidichi13-May-13 23:46
memberrnidichi13-May-13 23:46 
GeneralMy vote of 4 Pin
Mukund Thakker12-Oct-11 19:20
memberMukund Thakker12-Oct-11 19:20 
GeneralMy vote of 1 Pin
Kent K3-May-11 4:07
memberKent K3-May-11 4:07 
GeneralMy vote of 2 Pin
Jason Henderson3-May-11 3:46
memberJason Henderson3-May-11 3:46 
GeneralMy vote of 1 Pin
Selvin1-May-11 22:01
memberSelvin1-May-11 22:01 
GeneralRe: My vote of 1 Pin
Joe Gakenheimer30-Mar-14 16:20
memberJoe Gakenheimer30-Mar-14 16:20 
GeneralSimple but good description Pin
_Achilles_1-May-11 21:36
member_Achilles_1-May-11 21:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180515.1 | Last Updated 29 Apr 2011
Article Copyright 2011 by Mike Thom
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid