The .NET 3.0 introduced three main core technologies: • Windows Communication Foundation • Windows Presentation Foundation • Windows Workflow Foundation In this article, we will discuss the basic and fundamentals of Windows communication Foundation and in subsequent articles we will take up a journey through all these new technical revolutions embedded in .Net framework 3.0 and fine tuned in .Net framework 3.5. WCF is a unified framework for machine to machine and process to process communication. In the past you have worked with various technologies like web services, remoting, enterprise services and Microsoft Message queue. In WCF, Microsoft has integrated all these technologies into a common platform. WCF is designed to be the principal Microsoft platform for systems utilising the Service Oriented Architecture (SOA).

Introduction:

The .NET 3.0 introduced three main core technologies:
• Windows Communication Foundation
• Windows Presentation Foundation
•  Windows Workflow Foundation
In this article, we will discuss the basic and fundamentals of Windows communication Foundation and in subsequent articles we will take up a journey through all these new technical revolutions embedded in .Net framework 3.0 and fine tuned in .Net framework 3.5.
WCF is a unified framework for machine to machine and process to process communication. In the past you have worked with various technologies like web services, remoting, enterprise services and Microsoft Message queue. In WCF, Microsoft has integrated all these technologies into a common platform.  WCF is designed to be the principal Microsoft platform for systems utilising the Service Oriented Architecture (SOA).

Service Oriented Architecture and WCF:

Web development in recent years has moved from centralised local systems to vast complex distributed systems, where the entire system is divided into smaller modules which are hosted on different servers and run as services. All these services together serve a common purpose. The basic development technology catering to the need of different applications on the web so far is called Web Services and the same is still there at the core of design techniques of services. But the growth of distributed systems has given a paradigm change in the concept and has given birth to the concept of Service Orientation and Service Orientation architecture.
Let us get one point clear, service orientation has not replaced object orientation concepts. It in fact uses the object orientation concepts in its core but the service orientation architecture describes the distributed scenarios in the application development.
In Service Oriented Architecture the entire application is divided into services which communication via messages. Each service is designed to accomplish a particular goal. You can use different technologies and platforms to design different services. There are some universal formats to build messages and your services communicate using those messages. This way your entire application work.  The four principles of Service Orientation are:
• There should be explicit boundaries between services.
• Services should be autonomous.
• Services share schema and contract, not class.
WCF is a framework that works on the principles of Service Oriented Architecture and makes it relatively simple to implement. It provides some important enhancements in previous web services technology, which are:
• The previous technologies like web services, remoting, message queue, enterprise services are merged together which makes development easier.
• It provides 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.

WCF Fundamentals:

As the Services need to communicate with clients by sending and receiving messages, naturally in WCF 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 works as link between services and clients, for example, they can work as a firewall or can rout messages. 
As a developer you will be writing the clients and services. WCF generally takes care of the intermediaries and the messaging. A service can have more than one client and each service can be a client of another service. As you can see WCF is mainly about communication between services provided over the web, you will come across some important concepts like Channels, Bindings, Contracts, Behaviors, Addresses and Endpoints time and again.
Windows Communication Foundation has five-layer architecture. Developers with different skills generally work on different layers. These layers top to down are:
• Application Layer:  the application is located in the topmost layer.
• Contracts Layer: below the application layer is the contracts layer where the data and message contracts and bindings and policies are present.  In this level services describe themselves to clients.
• Runtime Layer: this layer loads the services and defines the Behaviors.
• Messaging Layer:  as the name suggests this layer is responsible for communication between services and deals with different channels and encoding.
•  Hosting Layer:  this layer contains the host services. You can host a service in two ways.
? You can host a service in Internet Information Services (IIS). This way your services are started and stopped automatically. 
? You can create executable files (.EXE) for services and start and stop them manually by writing codes.
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.
Generally, contracts and behaviors are declared using attributes, configure endpoints, security and some other settings in configuration files and service methods logic are implemented in codes. There are typed services and untyped services. In typed services normal objects and data types are passed and returned, and in untyped services the messages are passed and returned in the lower level.
If you are working with Visual Studio 2005, then you will have to install Visual Studio 2005 xtensions 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.
And if you are working with Visual Studio 2008, you get the new templates for WCF services, in the create web site dialog box.


 
Conclusion:

In this article, I have introduced WCF and its fundamentals. In the next following article, we will look into the differences between traditional web services and WCF services and from there we will move towards writing services. As I am going to take your leave for the time being, I hope I was able to create enough interest about this comparatively new and different way of web development.
See you!

Happy Programming!