Introduction to Windows Communication Foundation – A Comprehensive WCF Tutorial for Beginners

← PrevNext →

Distributed applications are not new to developers. There are many different approaches to designing and deploying distributed applications. The Windows Communication Foundation or WCF is a Microsoft technology or framework to design applications or services, distributed over the network on a variety of platforms.

Using WCF, we can send messages from one point to another. These points, also known as endpoints, can be either a client or a service.

A chatting application is a classic example of sharing or exchanging messages across the network using this process.

Why do we need WCF?

Microsoft first introduced WCF in .Net framework 3.0, and later used extensively in frameworks 3.5 and 4.0 respectively. Before the introduction of WCF, developers were already using Asp.Net Web Services to design service-oriented applications, for distributed environments.

Web services or ASMX services are simple and are relatively easy to use technology. All you needed is to add the service (.asmx file) in your web application and write public methods attached with an attribute called [WebMethod].

[WebMethod] in C# 

<WebMethod()> in Vb.Net 

A method attached in this way, would automatically becomes a service, ready to serve the client. You could add many methods serving different clients for different purposes.

C#
[WebMethod()]
public string TrainReservation(string sPass)
{
    ...
}
Vb.Net
<WebMethod()> _
Public Function TrainReservation(ByVal sPass As String) As String
    ...
End Function

There was an extensive use of Asp.Net web services in its initial stage, due to it simplicity. And trust me, it is still used in a wide range of applications.

Similar services like MSMQ, popularly know as Message Queuing, a messaging protocol that allows applications running on separate processes to commnunicate and .Net Remoting for transfering data between client and server, were extensively used by developers.

WCF Unified Model

There is a wide range of technologies, already available to help us implement distributed applications accorss the network, that were managable and easily repairable, then why there was a need for WCF.

Imagine how much effort and resource would have been necessary to design an enterprise level application using so many technologies, on different platforms.

WCF combines all these together into a single unified platform or framework, with more features and portability. The above image explains this. For different applications or services, we need to create different endpoints. We will learn more about endpoints later in this tutorial.

Next →