Key Notes To WCF

Introduction

WCF refers to Windows Communication Foundation and is a part of .NET 3.0 framework. WCF is a product developed by Microsoft.

It is called distributed applications.

This means an  application where parts of it are run on more than two computers.

These applications are also called  inter-connected systems. One application is running on one machine and a WCF Service is running on another machine. This the case, where it performs a basic role.

Three tier architecture based applications mostly use distributed applications. A three-tier architecture based application may need to use the Services provided by other organization. For example, when Flipkart and Amazon, use Paypal, Visa Service for the payments.

For better Security, an enterprise Web Application may have Presentation tier, Business tier and Data Access tier in addition to each tie, which may be running on two or more machines.

An application, which can be used by any other Application, which is built on any platform and is using any programming language like C#, Java etc. is called an interoperable Application. WCF Services are interoperable.

Difference between Web Services & .NET remote Service

The Web Services can communicate with any Application built on any platform, whereas a .NET remote Service can be consumed only by a .NET Application.
  • A Web Service can exchange messages in XML format, using HTTP protocol for  interoperability.
  • A remote Service to exchange messages in the binary format, using TCP protocol for the performance.
Real time example for better understanding about WCF

Let's have 2 customers and we need to build a Service for them.
  1. The first customers are using a PHP Application to interact with our Service, so the interoperability requirement of this customer is to be messaged in an XML format and the protocol is HTTP.
  2. The second customers use .NET, so for better performance; the requirement of this customer is to be messaged in the binary format and the protocol is  TCP protocol. 
You implement one Service and we can configure as many end points as we want to support all the customers' needs.
To support the above 2 customers requirements, we would configure 2 end points. In the endpoint configuration, we can specify the protocols and the message formats, which we want to use.

WCF = WEB SERVICES + .NET REMOTING SERVICES. 

If we do not use WCF for these two clients, then for the first client, we should use Web Services, which is ASMX Web Service. For the second client, we should use .NET Remote Services. To unify and bring all these technologies under a single part, Microsoft has introduced a single programming model, which is called WCF - Windows Communication Foundation.

The developer's work is minimized and less time consuming.

The Services are based on the different Transport protocols and the message formats.

We should use a single WCF Service and configure different endpoints to support different Transport protocols and the message formats. 

Summary

What is WCF?
What is Web Service and .NET Remote Service?