Tuesday, May 31, 2011

Introduction to WCF (Windows Communication Foundation)

WCF combines many previous Microsoft messaging technologies together into a standard coding framework. A service is written as a logical piece of work and is then exposed using whichever method is most appropriate. This keeps the service logic and the technical transportation pieces of the service separate and reduces the complexity.

Why WCF
Interoperability & Integration:
It allows you to connect to other technologies such as Message Queues and other technologies to connect to it.
Whole bunch of WS-* protocols are supported
Unified Programming model:
Whether you use TCP or Http or Pipes. Or transmitting using Messaging Queues, programmers need to learn just one way to program.
Previously you had .NET remoting, MSMQ, Web services, COM+ and they were all done differently
Productive Programming model:
Do not have to worry about all the plumbing work.
You want to add logging, no problem. You want to add transaction, no problem. You want to add reliable messaging – no problem.
Three ways of doing it – Declarative using Attributes, Imperative using the Object model in code and via Configuration to do it at run time

The EndPoint Anology

If we think about WCF services with a real world analogy. The address of the service is where it is located, this is unique to it just like the address of a house. Just as there can be many houses with unique addresses the same goes with WCF, each address can only be used for one service. Addresses must be unique.
Now that you know where you are going, the next question is how are you going to get there? How are you going to travel there? You could go by truck or train or walking, each has its own advantage/disadvantage.
The same question needs to be asked of the messages sent with WCF, how will they travel to where they are going? This could be via HTTP or TCP, or could be guarded with extra security as it travels.
Contracts are the menu of available functions the service provides.

Bindings

There are numerous ways that a message can be formatted/sent/secured, this allows you to tailor your service for the compatibility/performance you require for your solution.
Because there is such a large number of choices that can be made these have been packaged into ‘standard binding’ sets for easy use.
A service can support multiple sets of bindings, however each must be on a separate address. The Client must use exactly the same binding as service otherwise they will not be able to communicate properly.

No comments:

Post a Comment