Pages - Menu

Friday, January 16, 2015

What is WCF - Windows Communication Foundation

WCF stands for Windows Communication Foundation. It is released as  part of .NET 3.0. WCF is Microsoft platform for building distributed and interoperable applications. Now the first question, what is distributed application? It is an application where parts of it run on 2 or more computer nodes. It is also called as connected system. While interoperable application is an application that can communicate with any other application that is built on any platform.

Example 1:

A web application running on one machine is using a web service running on another machine. Might have you noticed that the eCommerce applications are consuming the Paypal service for payment which is running on a different machine and server.
Distributed System, WCF, connected system, web server, web application

Example 2:

An enterprise web application may have the different tiers, and each tier may be running on a different machine.
1. Presentation tier
2. Business tier
3. Data Access tier
Distributed System, WCF, enterprise application, 3 tier architecture, interoperable application

Now the first question is why would somebody breakdown an application into different tiers and why would they deployed those tiers on different machine? The answer is to improve the scalability of the application. Scalability means as the no. of users increase, you don't want the performance of the application to degrade. If you have less no of users, you can deploy all of the tiers on a single machine, but if you have a large no. of users then you need additional hardware to handle the request.

What technology choices did we have before WCF to build distributed and interoperable application?

Enterprise Services
.NET Remoting
Web Services

NOTE: Web services are interoperable while .NET remoting services are not. Web services can communicate with any application built on any platform, where as a .NET remoting service can be consumed only by another .NET application.

Why should we use WCF?

Now we will see the benefits of using WCF. Lets assume we have 2 clients and we need to implement a service for them.

Without WCF:

Our first client is using Java application to interact with our service, so far interoperability this client wants message to be in XML format and the protocol to be HTTP. To satisfy our first client we will implement a web service.

wcf, web service

Our second client is using .NET and he wants messages formatted in binary over TCP Protocol for better performance. To satisfy our second client we will implement a remoting service.

WCF, .NET remoting

So we are using two different technology to satisfy our clients to provide same messages in different format over different protocol. Web service and .NET remoting are two different technologies and both have different programming modals. So the developers have to learn different technologies to achieve the requirements. 

So to unify and bring all these communication technologies under one roof  Microsoft come up with a single programming modal WCF - Windows Communication Foundation.

With WCF:



we will implement one service and we can configure multiple end points to support all the client needs. To support our two client requirements, we would configure two end points. In the end point configuration we can specify the message formats and protocols that we want to use.

No comments:

Post a Comment