Introduction to Windows Communication Foundation:

Windows Communication Foundation is one of main new technologies that are included in .NET 3.0. Windows Communication Foundation (WCF), formerly code-named Indigo - a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.

It is one of the four major application programming interfaces introduced as part of .NET Framework 3.0, which is included with Windows Vista and Windows Server 2008.

The service-oriented programming model of Windows Communication Foundation is built on the Microsoft .NET Framework and simplifies development of connected systems. Windows Communication Foundation unifies a broad array of distributed systems capabilities in a compassable and extensible architecture, spanning transports, security systems, messaging patterns, encodings, network topologies, and hosting models. It is intended to provide the rapid application development methodology to the development of web services, with a single API for inter process communication in a local machine, LAN or over the Internet

Fundamental Concepts:

In Windows Communication Foundation your services can have communication with clients by sending and receiving messages.



Windows Communication Foundation 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 sit between services and clients .They can work as a firewall or can rout messages. In all cases neither services nor clients need to be aware of intermediaries.




WCF Service:

A WCF Service is composed of three parts — a Service class that implements the service to be provided, a host environment to host the service, and one or more  endpoints to which clients will connect. All communications with the WCF service will happen via the endpoints. The endpoints specify a Contract that defines which methods of the Service class will be accessible via the endpoint; each endpoint may expose a different set of methods. The endpoints also define a binding that specifies how a client will communicate with the service and the address where the endpoint is hosted.

WCF provides Windows Activation Services which can be used to host the WCF service. Otherwise the WCF service can also be hosted in IIS or in any process by using the Service Host class, which is provided by WCF. Services can also be self hosted.

Architecture:

Architecture of Windows Communication Foundation consists of five layers. These layers from top to down are:

Application:

In this level application is located.

Contracts:

 In the second layer service, data and message contracts as well as bindings and policies are present. In this level services describe themselves to clients.

Runtime:

 Behaviors are located in this layer. Runtime layer loads all services.

Messaging:

Different types of channels as well as encoders are here. This layer enables communications for services.

Hosting:

This layer is where host services in different manners, but there are two common ways to host a service. One can host a service in Internet Information
Services (IIS) which is easier than the second approach and starts and stops the services automatically. The second approach is to create executable files (.EXE) for services and start and stop them manually by writing more codes.

This layering allows developers to work on Windows Communication Foundation with different skills because each layer needs different skills.



Programming Model:

Windows Communication Foundation has simple and easy to write/understand codes. It has many APIs, but beside this only a small amount of these API's is common.

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.

In general, you will declare contracts and behaviors using attributes configure endpoints, security and some other settings in configuration files and will implement service methods logic in codes. On the other hand, you can use typed services and un- typed services. In typed services you pass normal objects and data types and/or get normal objects and data types, but in un-typed services you pass and get messages to work directly with messages at a lower level.

Advantages:

Windows Communication Foundation has some important enhancements in comparison with preceding technologies. It merges all older separate technologies in one place and allows us to do things easier.

It has 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.



More about details to reference:


Posted in:

1 comment: