Introduction to Windows Communication Foundation
 
Published: 03 Jan 2007
Abstract
Windows Communication Foundation is one of main new technologies that are included in .NET 3.0. In this article, as the first part of his Windows Communication Foundation tutorials, Keyvan introduces Windows Communication Foundation and some principles behind it.
by Keyvan Nayyeri
Feedback
Average Rating: 
Views (Total / Last 10 Days): 77765/ 123

Overview

.NET 3.0 comes with three main technologies in core: Windows Presentation Foundation, Windows Workflow Foundation and Windows Communication Foundation.  In past tutorials I introduced Windows Presentation Foundation and XAML and now I want to try things for Windows Communication Foundation.

Windows Communication Foundation (WCF), codenamed Indigo in Microsoft, is the last generation of service oriented technologies for development.  It provides all the latest means to help developers build service oriented applications.  The result of service oriented design is a distributed system which runs between services and clients.  Windows Communication Foundation is Microsoft infrastructure for Service Oriented architecture.

You have probably worked with Web Services in .NET 1.x or 2.0 and may have some experiences with Remoting.  Windows Communication Foundation is an enhanced technology to provide the same functionality with better features and reduces the time to develop a distributed system.  Web Services and Services are not identical.  One main difference is Web Services use HTTP protocol, but Services can use any protocol and this is an important difference.

The first part of this article is a Windows Communication Foundation tutorials; I introduce this new technology, its architecture, programming model, service orientated design and give some other necessary information to start with this technology.

Service Orientation

Almost all developers know something about Object Oriented Programming (OOP) which has been a common way to build software for a long time.  But what is Service Oriented architecture?

In recent years, development moved from building centralized local systems to distributed systems which run on several places.  Each part of these systems are hosted somewhere and provide some services.  The idea of having services to answer to common needs through the web became serious and development technologies answered to this need by providing Web Services in their core, but day after day distributed systems became more common and the idea of Service Orientation (SO) was born.

Service Orientation is a complement to Object Orientation.  It means you will not kick Object Orientation out to use Service Orientation.  Service Orientation uses Object Orientation in its core, but there are some distributed scenarios that can be viewed by Object Orientation so you use Service Orientation to describe these scenarios.

In Service Orientation you think different and describe things via services and divide your system into smaller parts which run as services.  These services can communicate with others via messages.  In each service you can apply Object Orientation to accomplish goals of that service.  One important benefit of Service Orientation is here because you can use different technologies and platforms to design a service by using Object Orientation then use universal formats to build messages and start communication between different pieces of your system.

There are four principles in Service Orientation (you may see them as tenets on other resources):

·         Boundaries are explicit.

·         Services are autonomous.

·         Services share schema and contract, not class.

·         Service compatibility is determined based on policy.

You can read more about these fundamentals (they are important principles) on MSDN.

Generally, you have to change your point of view in Service Oriented design, but this should not change your view for Object Oriented Programming.  You should get enough experience to divide a system to logical independent services then choose appropriate platform to build each piece.  Thankfully, Microsoft helps you in all stages and you can use powerful Microsoft technologies to build your distributed software.

Service Oriented Architecture (SOA) is a concept beyond the scope of these tutorials.  I recommend you to read good books about Service Oriented Architecture to learn more about it.  Having a good understanding of this architecture is an important requirement to be success in this field.

Advantages

Windows Communication Foundation has some important enhancements in comparison with preceding technologies.

·         It merges all older separate technologies in one place and allows you to do things easier.

·         It has rich communication capabilities.

·         It comes with many powerful and ready to use enterprise features.

·         It can be integrated with other technologies and has great interoperability.

Fundamental Concepts

In Windows Communication Foundation your services can have communication with clients by sending and receiving messages (Figure 1).

Figure 1

Windows Communication Foundation consists of three main concepts:

·         Services: Programs that respond to clients.  They can send or receive messages.

·         Clients: Programs that ask for a service.  They can send or receive messages.

·         Intermediaries: Programs that sit between services and clients (Figure 2).  They can work as a firewall or can rout messages.  In all cases neither services nor clients need to be aware of intermediaries.

Figure 2

Most of the time, developers deal with services and clients and do not need to work much with intermediaries.

Services and clients have communications by sending and receiving messages, but again most of the time you do not work directly with messages and Windows Communication Foundation does this for you.

Here you should learn that a service can have more than one client (Figure 3) and each service can be a client of another service itself (Figure 4).

Figure 3

Figure 4

Each of these main concepts has important concepts in its core or beside it.  Some other concepts that you will deal with frequently are Channels, Bindings, Contracts, Behaviors, Addresses and Endpoints.

In the second part of these tutorials I will describe all important concepts in some details.

Architecture

Architecture of Windows Communication Foundation consists of five layers.  These layers from top to down are:

·         Application: In this level application is located.

·         Contracts: In the second layer service, data and message contracts as well as bindings and policies are present.  In this level services describe themselves to clients.

·         Runtime: Behaviors are located in this layer.  Runtime layer loads all services.

·         Messaging: Different types of channels as well as encoders are here.  This layer enables communications for services.

·         Hosting: This layer is where host services in different manners, but there are two common ways to host a service.  You can host a service in Internet Information Services (IIS) which is easier than the second approach and starts and stops your services automatically.  The second approach is to create executable files (.EXE) for services and start and stop them manually by writing more codes.

This layering allows developers to work on Windows Communication Foundation with different skills because each layer needs different skills.

Programming Model

Windows Communication Foundation has simple and easy to write/understand codes.  It has many APIs, but beside this only a small amount of these API's is common.

There are three programming approaches in Windows Communication Foundation:

·         Imperative: You use programming codes in different languages to accomplish a task.

·         Configuration Based: You use configuration files to do things.

·         Declarative: You use attributes to declare something.

In general, you will declare contracts and behaviors using attributes, configure endpoints, security and some other settings in configuration files and will implement service methods logic in codes.

On the other hand, you can use typed services and untyped services.  In typed services you pass normal objects and data types and/or get normal objects and data types, but in untyped services you pass and get messages to work directly with messages at a lower level.

Installation

Installation of Windows Communication Foundation and its development tool is easy and consists of these steps:

·         Download and install .NET Framework 3.0 RTM.  I also strongly recommend you to download and install WinFX SDK as well.  After this step you have all necessary API's to run Windows Communication Foundation.

·         Download and install Visual Studio 2005xtensions for .NET Framework 3.0 WCF and WPF).  After installing this package, you will have new project templates in your Visual Studio to start developing for Windows Communication Foundation (Figure 5 and Figure 6).

Figure 5

Figure 6

References

Here is a list of available books about Windows Communication Foundation.

·         Microsoft Windows Communication Foundation: Hands-on written by Craig McMurtry, Marc Mercuri and Nigel Watling (Sams)

·         Programming WCF Services written by Juval Lowy (O'Reilly)

·         Pro WCF: Practical Microsoft SOA Implementation written by Chris Peiris, Dennis Mulder, Amit Bahree, Aftab Chopra, Shawn Cicoria and Nishith Pathak (APress)

·         Programming INDIGO written by David Pallmann (Microsoft Press)

And here is a list of online resources and communities about Windows Communication Foundation.

·         Microsoft Windows Communication Foundation Community

·         Windows Communication Foundation homepage on MSDN

·         Windows Communication Foundation Forum

Summary

In this article I introduced Windows Communication Foundation as Microsoft fundamental for Service Oriented architecture and building distributed systems.  I gave basic information about Service Oriented Architecture (SOA), fundamental concepts, architecture and programming model.  Finally, I gave a list of useful resources for further reading.  Keep looking for new parts of these tutorials.  I will try to cover more and more about this great new technology in .NET 3.0.



User Comments

Title: Good for new .net developer   
Name: gautam
Date: 2013-02-06 8:35:37 AM
Comment:
Explain way is very iterative so its easily understand..
Title: thanks a lot..very nice article.easy to understand.. Name: thanks a lot..very nice article.easy to understand..   
Name: thanks a lot..very nice article.easy to understand.. Name: thanks a lot..very nice article.easy to understand..
Date: 2013-01-21 4:44:43 AM
Comment:
thanks a lot..very nice article.easy to understand..
Title: gh   
Name: hggh
Date: 2012-10-22 1:30:42 PM
Comment:
yguhgh
Title: sa   
Name: sa
Date: 2012-08-16 11:34:45 AM
Comment:
asd
Title: thanks a lot..very nice article.easy to understand..   
Name: thanks a lot..very nice article.easy to understand..
Date: 2011-03-24 5:19:21 AM
Comment:
thanks a lot..very nice article.easy to understand..
Title: thanks...   
Name: Gourik kumar
Date: 2011-03-23 2:33:27 AM
Comment:
thanks a lot..very nice article.easy to understand..
Title: Simplicity   
Name: Bharath Krishna
Date: 2010-11-22 4:15:33 AM
Comment:
Wonderful article. In reality, WCF is not very easy to understand. But, the methodical way in which you have explained the concepts, the carefully examined & chosen words makes this article not only interesting to read but also makes any one understand the concepts of WCF. Great job!!! Keep posting more articles.
Title: overview   
Name: Ramesh
Date: 2010-10-12 10:59:31 AM
Comment:
Very Good article
Title: Thanks   
Name: Anil Thakur
Date: 2010-08-18 3:03:47 AM
Comment:
Good one for beginner!
Title: Thank You   
Name: Safiya P
Date: 2010-08-11 8:06:04 AM
Comment:
Thank you for ur tutorial....
Title: Nice   
Name: Faraz
Date: 2010-06-15 11:46:44 AM
Comment:
Nice article this. Gives the basic information
Title: WCF   
Name: senthil
Date: 2010-06-11 1:43:37 AM
Comment:
Easy to understand and well defined explanation.
Thank you very much.
Title: A very Good Introduction to WCF   
Name: Ramu
Date: 2010-05-21 9:22:41 AM
Comment:
Very easy and very much understandable explanation about WCF. Thank you for providing this.

http://dotnetwithexamples.blogspot.com
Title: WCF   
Name: RAJASEKHAR
Date: 2010-05-03 6:59:09 AM
Comment:
Good explanation but some clear information about wcf is needed
Title: Description was excellent   
Name: Nishank
Date: 2010-03-21 2:16:29 AM
Comment:
The way he has described the complex WCF is really appreciable.
I am new to this technology and thankful to him for giving such a nice basic tutorial.
Keep posting buddy..
Title: Good Introduction of WCF   
Name: Ravi Kumar
Date: 2010-02-24 11:51:37 AM
Comment:
I found acticle is good for person who wants overview of WCF
Title: A handy introduction to WCF   
Name: Arash
Date: 2009-12-24 10:36:19 PM
Comment:
This is a good article,

Thank you,
Arash
Title: Foundation consists of five layers.   
Name: These layers from top to down are:
Date: 2009-12-04 6:21:19 AM
Comment:
Application: In this level application is located.

· Contracts: In the second layer service, data and message contracts as well as bindings and policies are present. In this level services describe themselves to clients.

· Runtime: Behaviors are located in this layer. Runtime layer loads all services.

· Messaging: Different types of channels as well as encoders are here. This layer enables communications for services.

· Hosting: This layer is where host services in different manners, but there are two common ways to host a service. You can host a service in Internet Information Services (IIS) which is easier than the second approach and starts and stops your services automatically. The second approach is to create executable files (.EXE) for services and start and stop them manually by writing more codes.
Title: Little Idea about WCF   
Name: Pawan Gera
Date: 2009-11-05 6:19:09 AM
Comment:
Hi,

This document gives only a little idea about the wcf.

BstRgds
Title: Nice Intro   
Name: pankaj
Date: 2009-10-14 9:44:03 AM
Comment:
Hi Buddy,
Can you also post some exemples that how to use WCF service with Database. Like how to insert & Fetch Data from database using WCF services.

regards
Pankaj
Title: Good Intro   
Name: Aju
Date: 2009-07-28 3:07:21 AM
Comment:
Good for Begineer.
Title: Basics of WCF   
Name: sandy
Date: 2009-07-14 6:39:09 AM
Comment:
This throws the light on WCF which is very basics,but can be helpful to beginner. Would appreciate if some information displayed.
Title: great introduction   
Name: sertac benzer
Date: 2009-06-18 2:10:36 PM
Comment:
it a great start for those who want to realize logic of WFC. On the other hand, more sophisticated example would be better.
Title: very good   
Name: veera
Date: 2009-01-08 1:37:16 AM
Comment:
It is helpfull for beginers and please provide some more information by differntiating with webservices
Title: Introduction is good   
Name: AKshay Agrawal
Date: 2008-12-22 8:55:03 AM
Comment:
The intro for the WCF is good. It provides the basic understanding of the WCF concept and architecture.
Title: wcf   
Name: cHOWDAREy
Date: 2008-12-04 2:38:33 PM
Comment:
it ok for wcf beginners , good

Thanks
cHOWDAREy
Title: WCF   
Name: cHOWDAREy
Date: 2008-12-04 2:37:01 PM
Comment:
This is very good for those who want to know something about wcf. it is ok for them.

it is good if provide some additional stuff also.

Thanks
cHOWDAREy
Title: Excelent overview   
Name: majovi
Date: 2008-11-25 2:44:23 PM
Comment:
Thanks...
Title: Nice   
Name: Niranjan Shrestha
Date: 2008-11-18 12:21:28 PM
Comment:
Nice material for the beginners
Title: Excellent   
Name: Sayeed
Date: 2008-10-27 7:24:55 AM
Comment:
Good Boss...:-)
Title: Very Good Topics   
Name: Mudit
Date: 2008-10-24 5:23:16 PM
Comment:
UR Effort id priceless
Title: Nice tutorial   
Name: Vamsi
Date: 2008-09-23 9:17:49 AM
Comment:
Very nice ... keep on ..
Title: Nice Article   
Name: Dharuman
Date: 2008-09-04 12:59:08 PM
Comment:
I am a beinnger to WCF, this is good article to understand.
Thanks a lot.
Title: Software Engineer   
Name: Ashotosh Das
Date: 2008-08-14 8:56:35 PM
Comment:
This is a very good Article and it helps me a lot
Title: Its Excellent   
Name: Vinay Kumar.D
Date: 2008-08-05 1:31:21 AM
Comment:
Iam really i need of a WCF material.It really helps me a lot,for my further references.......
I hope for more information with some examples........
Title: Great Effort   
Name: Pankaj Lahoti
Date: 2008-07-31 6:09:16 AM
Comment:
hai,
Nice one for newbie,need more Inf .....hopefully will find in future posts..
Title: Good one   
Name: Ritesh Shah
Date: 2008-07-09 6:30:31 AM
Comment:
Those who want to have a quick and easy understanding about WCF and net .net 3.0 offerings , this article provide the one stop solution for them. a wonderful effort for the developer community. Many Thanks...
Title: Nice one   
Name: Karman Shahid
Date: 2008-07-07 8:32:40 AM
Comment:
I were looking for get started in WCF and it really helps a lot.
Thanks Keyvan Nayyeri.
Title: Nice One   
Name: Brajendu Kumar Das
Date: 2008-07-04 7:08:50 AM
Comment:
Very simple and Very Nice.. Thank You...but was needing a little more descriptive.
Title: Technical Consultant   
Name: Nari
Date: 2008-06-20 3:08:40 AM
Comment:
Good overview...thanks!!
Title: Nice Article   
Name: Vilas Suryawanshi
Date: 2008-05-31 12:42:48 AM
Comment:
I doing job as .Net Developer so I read this article , so very nice and good appearance.
Title: Nice Presentation   
Name: Anand Gupta
Date: 2008-05-29 2:52:11 AM
Comment:
I am working on ASP.Net since last 3 Yrs, and Now I am starting my new project in 3.5 so I need to explore WCF, and i am very thank full, that this article provide me the nice introduction, We appreciate if article having some pictorial way to understand it very fast. Thank You.
Title: Simple Presentation   
Name: Uday kumar Adapa
Date: 2008-05-20 3:31:00 PM
Comment:
The presentationis very simple and good one ,but it would be a little more desctiptive.
Title: Good Presentation   
Name: Jessy
Date: 2008-04-24 10:00:02 AM
Comment:
It is really a very good material for beginners.
Would appreciate if you could include some sample applications :)
Keep up the good work
Title: Simple Presentation   
Name: Brajendu Kumar Das
Date: 2008-04-15 7:21:30 AM
Comment:
The presentationis very simple and good one ,but it would be a little more desctiptive.
Title: Easy and Autonomous   
Name: Amit Bhatnagar
Date: 2008-04-08 11:27:41 AM
Comment:
I have been in IT since 6 years and working with ASP.Net since a long time. Infact today is my fisrt day to have start a new project in ASP.Net3.0. For this prospective i was lloking for easy and effective article, although its very difficult to find out a simple and easy to understand explanation. But you did it for me and for many more. Gr8 thanks for mentioning valuable reference regarding WCF with in your article, all that stuff is also useful. Your article helps me very much. Thanks a lot.
Title: Information Systems Manager   
Name: Mr. B
Date: 2008-04-04 2:16:34 PM
Comment:
I have been in IT for 20 years and quite honestly am tired of continuously going back to school to learn the "New" technologies. As such i never learned about .Net and the newer concepts like WCF. In conducting internet research to obtain an understanding of WCF, other than the verbose and confusing microsoft microbabel, it was difficult to find a simple and easy to understand explanation. Your article helps very much. Thanks.
Title: easy to understand   
Name: Archana.
Date: 2008-04-03 5:49:23 AM
Comment:
Very effective and easy to understand for beginners
Title: simply better   
Name: sanjay choubey
Date: 2008-04-01 7:49:06 AM
Comment:
The core concepts are explained in a very effective and simple manner that any new user can easily cope the concept of wcf.
Title: When?   
Name: Keyvan Nayyeri
Date: 2008-01-29 11:58:09 AM
Comment:
If you take a look at the publish date, can simply believe that this article was published when there weren't many resources about WCF and it was a completely new technology for the community in .NET 3.0 days. This tutorial series was an attempt to help the community and feedbacks say that it was success in this way.
Title: Simple   
Name: Aakash
Date: 2008-01-29 6:24:32 AM
Comment:
it's too simple. Could be more better.
Title: Effective   
Name: Avinash Patel
Date: 2007-12-13 4:34:51 AM
Comment:
It really helped a lot for understanding the concept of WCF.
Title: Very good   
Name: Sreekanth Purusothaman
Date: 2007-10-18 11:08:10 PM
Comment:
We cannot expect anything simple and yet comprehensive.

Thanks a lot!!!!
Title: Lucid and simple   
Name: Deepak Pawar
Date: 2007-10-12 9:55:34 AM
Comment:
Very simple to understand , Expressed Nicely for a newbie.
Title: Nice Work   
Name: Thurein
Date: 2007-08-19 10:57:06 PM
Comment:
A very comprehensive article.

Thanks,
Title: Good Work   
Name: Sameer
Date: 2007-07-10 8:11:59 AM
Comment:
Good article to start with WCF. Please keep up the good work.
Title: good   
Name: sridhar
Date: 2007-05-02 7:36:40 AM
Comment:
It's really good

Thanks

Sridhar
Title: Very Nice   
Name: Arun G S
Date: 2007-04-24 6:13:47 AM
Comment:
very nice and simple document. easier to understand.. gr8 effort..
Title: Nice Document   
Name: Amit Patil
Date: 2007-02-01 6:09:32 PM
Comment:
Hi,

Thanks a lot for making such a great document. It helps a lot for the beginners...

Thanks
Amit Patil
Title: Nice Effort   
Name: Muhamamd Badar
Date: 2007-01-24 8:15:13 AM
Comment:
Hello Dear ....
A nice effort for those who want to shift to the new technology
Regards,
Muhammad Badar
Title: Great Article   
Name: AzamSharp
Date: 2007-01-07 8:07:09 PM
Comment:
Hi,

Another great article!!!

Thanks :)
AzamSharp

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-07-19 4:55:44 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search