Sunday, December 20, 2009

Windows Communication Foundation Architecture Overview

Summary: Get a high-level view of the Windows Communication Foundation (WCF) architecture and its key concepts. Code examples demonstrate WCF contracts, endpoints, and behaviors. (17 printed pages)

Contents

Introduction

WCF Fundamentals

Code Examples

Summary

Introduction

This document provides a high-level view of the Windows Communication Foundation (WCF) architecture. It is intended to explain key concepts in WCF and how they fit together. There are a few code examples to further illustrate the concepts, but code is not the emphasis of this document.

The rest of this document is organized in two main sections:

• WCF Fundamentals: Covers key concepts in WCF, terms, and architectural components.

• Code Examples: Provides a few short code examples intended to illustrate and reify the concepts covered in WCF Fundamentals.

WCF Fundamentals

A WCF Service is a program that exposes a collection of Endpoints. Each Endpoint is a portal for communicating with the world.

A Client is a program that exchanges messages with one or more Endpoints. A Client may also expose an Endpoint to receive Messages from a Service in a duplex message exchange pattern.

The following sections describe these fundamentals in more detail.

Endpoints

A Service Endpoint has an Address, a Binding, and a Contract.

The Endpoint's Address is a network address where the Endpoint resides. The EndpointAddress class represents a WCF Endpoint Address.

The Endpoint's Binding specifies how the Endpoint communicates with the world including things like transport protocol (e.g., TCP, HTTP), encoding (e.g., text, binary), and security requirements (e.g., SSL, SOAP message security). The Binding class represents a WCF Binding.

The Endpoint's Contract specifies what the Endpoint communicates and is essentially a collection of messages organized in operations that have basic Message Exchange Patterns (MEPs) such as one-way, duplex, and request/reply. The ContractDescription class represents a WCF Contract.

The ServiceEndpoint class represents an Endpoint and has an EndpointAddress, a Binding, and a ContractDescription corresponding to the Endpoint's Address, Binding, and Contract, respectively (see Figure 1).



Figure 1. Each Service's Endpoint contains an EndpointAddress, a Binding and a Contract represented by ContractDescription.

EndpointAddress

An EndpointAddress is basically a URI, an Identity, and a collection of optional headers as shown in Figure2.

An Endpoint's security identity is normally its URI; however, in advanced scenarios the identity can be explicitly set independent of the URI using the Identity address property.

The optional headers are used to provide additional addressing information beyond the Endpoint's URI. For example, address headers are useful for differentiating between multiple Endpoints that share the same address URI.




Figure 2. EndpointAddress contains a URI and AddressProperties contains an Identity and a collection of AddressHeaders.

Bindings

A Binding has a name, a namespace, and a collection of composable binding elements (Figure 3). The Binding's name and namespace uniquely identify it in the service's metadata. Each binding element describes an aspect of how the Endpoint communicates with the world.




Figure 3. Binding class and its members

For example, Figure 4 shows a binding element collection containing three binding elements. The presence of each binding element describes part of the how of communicating with the Endpoint. The TcpTransportBindingElement indicates that the Endpoint will communicate with the world using TCP as the transport protocol. ReliableSessionBindingElement indicates that the Endpoint uses reliable messaging to provide message delivery assurances. SecurityBindingElement indicates that the Endpoint uses SOAP message security. Each binding element usually has properties that further describe the specifics of the how of communicating with the Endpoint. For example, the ReliableSessionBindingElement has an Assurances property that specifies the required message delivery assurances, such as none, at least once, at most once, or exactly once.




Figure 4. An example Binding with three binding elements

The order and types of binding elements in Bindings are significant: The collection of binding elements is used to build a communications stack ordered according to the order of binding elements in the binding elements collection. The last binding element to be added to the collection corresponds to the bottom component of the communications stack, while the first one corresponds to the top component. Incoming messages flow through the stack from the bottom upwards, while outgoing messages flow from the top downwards. Therefore the order of binding elements in the collection directly affects the order in which communications stack components process messages. Note that WCF provides a set of pre-defined bindings that can be used in the majority of scenarios instead of defining custom bindings.

Contracts

A WCF Contract is a collection of Operations that specifies what the Endpoint communicates to the outside world. Each operation is a simple message exchange, for example one-way or request/reply message exchange.

The ContractDescription class is used to describe WCF Contracts and their operations. Within a ContractDescription, each Contract operation has a corresponding OperationDescription that describes aspects of the operation such as whether the operation is one-way or request/reply. Each OperationDescription also describes the messages that make up the operation using a collection of MessageDescriptions.

A ContractDescription is usually created from an interface or class that defines the Contract using the WCF programming model. This type is annotated with ServiceContractAttribute and its methods that correspond to Endpoint Operations are annotated with OperationContractAttribute. You can also build a ContractDescription by hand without starting with a CLR type annotated with attributes.

A duplex Contract defines two logical sets of operations: A set that the Service exposes for the Client to call and a set that the Client exposes for the Service to call. The programming model for defining a duplex Contract is to split each set in a separate type (each type must be a class or an interface) and annotate the contract that represents the service's operations with ServiceContractAttribute, referencing the contract that defines the client (or callback) operations. In addition, ContractDescription contains a reference to each of the types thereby grouping them into one duplex Contract.

Similar to Bindings, each Contract has a Name and Namespace that uniquely identify it in the Service's metadata.

Each Contract also has a collection of ContractBehaviors that are modules that modify or extend the contract's behavior. The next section covers behaviors in more detail.




Figure 5. ContractDescription class describes a WCF contract

Behaviors

Behaviors are types that modify or extend Service or Client functionality. For example, the metadata behavior that ServiceMetadataBehavior implemented controls whether the Service publishes metadata. Similarly, the security behavior controls impersonation and authorization, while the transactions behavior controls enlisting in and auto-completing transactions.

Behaviors also participate in the process of building the channel and can modify that channel based on user-specified settings and/or other aspects of the Service or Channel.

A Service Behavior is a type that implements IServiceBehavior and applies to Services. Similarly, a Channel Behavior is a type that implements IChannelBehavior and applies to Client Channels.

Service and Channel Descriptions

The ServiceDescription class is an in-memory structure that describes a WCF Service including the Endpoints exposed by the Service, the Behaviors applied to the Service, and the type (a class) that implements the Service (see Figure 6). ServiceDescription is used to create metadata, code/config, and channels.

You can build this ServiceDescription object by hand. You can also create it from a type annotated with certain WCF attributes, which is the more common scenario. The code for this type can be written by hand or generated from a WSDL document using a WCF tool called svcutil.exe.

Although ServiceDescription objects can be created and populated explicitly, they are often created behind the scenes as part of running the Service.




Figure 6. ServiceDescription object model

Similarly on the client side, a ChannelDescription describes a WCF Client's Channel to a specific Endpoint (Figure 7). The ChannelDescription class has a collection of IchannelBehaviors, which are Behaviors applied to the Channel. It also has a ServiceEndpoint that describes the Endpoint with which the Channel will communicate.


Note that, unlike ServiceDescription, ChannelDescription contains only one ServiceEndpoint that represents the target Endpoint with which the Channel will communicate.



Figure 7. ChannelDescription object model

WCF Runtime

The WCF Runtime is the set of objects responsible for sending and receiving messages. For example, things like formatting messages, applying security, and transmitting and receiving messages using various transport protocols, as well as dispatching received messages to the appropriate operation, all fall within the WCF runtime. The following sections explain the key concepts of the WCF runtime.

Message

The WCF Message is the unit of data exchange between a Client and an Endpoint. A Message is essentially an in-memory representation of a SOAP message InfoSet. Note that Message is not tied to text XML. Rather, depending on which encoding mechanism is used, a Message can be serialized using the WCF binary format, text XML, or any other custom format.

Channels

Channels are the core abstraction for sending Messages to and receiving Messages from an Endpoint. Broadly speaking, there are two categories of Channels: Transport Channels handle sending or receiving opaque octet streams using some form of transport protocol such as TCP, UDP, or MSMQ. Protocol Channels, on the other hand, implement a SOAP-based protocol by processing and possibly modifying messages. For example, the security Channel adds and processes SOAP message headers and may modify the body of the message by encrypting it. Channels are composable such that a Channel may be layered on top of another Channel that is in turn layered on top of a third Channel.

EndpointListener

An EndpointListener is the runtime equivalent of a ServiceEndpoint. The EndpointAddress, Contract, and Binding of ServiceEndpoint (representing where, what and how), correspond to the EndpointListener's listening address, message filtering and dispatch, and channel stack, respectively. The EndpointListener contains the Channel stack that is responsible for sending and receiving messages.

ServiceHost and ChannelFactory

The WCF Service runtime is usually created behind the scenes by calling ServiceHost.Open. ServiceHost (Figure 6) drives the creation of a ServiceDescription from on the Service type and populates the ServiceDescription's ServiceEndpoint collection with Endpoints defined in config or code, or both. ServiceHost then uses the ServiceDescription to create the channel stack in the form of an EndpointListener object for each ServiceEndpoint in the ServiceDescription.



Figure 8. ServiceHost object model

Similarly, on the client side, the Client runtime is created by a ChannelFactory, which is the Client's equivalent of ServiceHost.

ChannelFactory drives the creation of a ChannelDescription based on a Contract type, a Binding, and an EndpointAddress. It then uses this ChannelDescription to create the Client's channel stack.

Unlike the Service runtime, the Client runtime does not contain EndpointListeners because a Client always initiates connection to the Service, so there is no need to "listen" for incoming connections.

Code Examples

This section provides code examples that show how Services and Clients are built. These examples are intended to reify the above concepts and not to teach WCF programming.

Defining and Implementing a Contract

As mentioned above, the easiest way to define a contract is creating an interface or a class and annotating it with ServiceContractAttribute, allowing the system to easily create from it a ContractDescription.

When using interfaces or classes to define contracts, each interface or class method that is a member of the contract must be annotated with OperationContractAttribute. For example:





using System.ServiceModel;



//a WCF contract defined using an interface

[ServiceContract]

public interface IMath

{

[OperationContract]

int Add(int x, int y);

}

Implementing the contract in this case is simply a matter of creating a class that implements IMath. That class becomes the WCF Service class. For example:





//the service class implements the interface

public class MathService : IMath

{

public int Add(int x, int y)

{ return x + y; }

}

Defining Endpoints and Starting the Service

Endpoints can be defined in code or in config. In the example below, the DefineEndpointImperatively method shows the easiest way to define Endpoints in code and start the service.

DefineEndpointInConfig method shows the equivalent endpoint defined in config (config example follows the code below).


public class WCFServiceApp

{

public void DefineEndpointImperatively()

{

//create a service host for MathService

ServiceHost sh = new ServiceHost(typeof(MathService));


//use the AddEndpoint helper method to

//create the ServiceEndpoint and add it

//to the ServiceDescription

sh.AddServiceEndpoint(

typeof(IMath), //contract type

new WSHttpBinding(), //one of the built-in bindings

"http://localhost/MathService/Ep1"); //the endpoint's address



//create and open the service runtime

sh.Open();



}



public void DefineEndpointInConfig()

{

//create a service host for MathService

ServiceHost sh = new ServiceHost (typeof(MathService));



//create and open the service runtime

sh.Open();



}

}





xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">













address="http://localhost/MathService/Ep1"

binding="wsHttpBinding"

contract="IMath"/>









Sending Messages to an Endpoint

The code below shows two ways to send a message to the IMath endpoint. SendMessageToEndpoint hides the Channel creation, which happens behind the scenes while the SendMessageToEndpointUsingChannel example does it explicitly.

The first example in SendMessageToEndpoint uses a tool named svcutil.exe and the Service's metadata to generate a Contract (IMath in this example), a proxy class (MathProxy in this example) that implements the Contract, and associated config (not shown here). Again, the Contract defined by IMath specifies the what (i.e., the operations that can be performed), while the generated config contains a Binding (the how) and an address (the where).

Using this proxy class is simply a matter of instantiating it and calling the Add method. Behind the scenes, the proxy class will create a Channel and use that to communicate with the Endpoint.

The second example in SendMessageToEndpointsUsingChannel below shows communicating with an Endpoint using ChannelFactory directly. In this example, instead of using a proxy class and config, a Channel is created directly using ChannelFactory.CreateChannel. Also, instead of using config to define the Endpoint's address and Binding, the ChannelFactory constructor takes those two pieces of information as parameters. The third piece of information required to define an Endpoint, namely the Contract, is passed in as the type T.

using System.ServiceModel;

//this contract is generated by svcutil.exe

//from the service's metadata

public interface IMath

{

[OperationContract]

public int Add(int x, int y)

{ return x + y; }

}





//this class is generated by svcutil.exe

//from the service's metadata

//generated config is not shown here

public class MathProxy : IMath

{

...

}



public class WCFClientApp

{

public void SendMessageToEndpoint()

{

//this uses a proxy class that was

//created by svcutil.exe from the service's metadata

MathProxy proxy = new MathProxy();



int result = proxy.Add(35, 7);

}

public void SendMessageToEndpointUsingChannel()

{

//this uses ChannelFactory to create the channel

//you must specify the address, the binding and

//the contract type (IMath)

ChannelFactory factory=new ChannelFactory(

new WSHttpBinding(),

new EndpointAddress("http://localhost/MathService/Ep1"));

IMath channel=factory.CreateChannel();

int result=channel.Add(35,7);

factory.Close();



}

}

Defining a Custom Behavior

Defining a custom Behavior is a matter of implementing IServiceBehavior (or IChannelBehavior for client-side behaviors). The code below shows an example behavior that implements IServiceBehavior. In IServiceBehavior.ApplyBehavior, the code inspects the ServiceDescription and writes out the Address, Binding, and Contract of each ServiceEndpoint, as well as the name of each Behavior in the ServiceDescription.

This particular behavior is also an attribute (inherits from System.Attribute), making it possible to apply declaratively as will be shown below. However, behaviors are not required to be attributes.


[AttributeUsageAttribute(

AttributeTargets.Class,

AllowMultiple=false,

Inherited=false)]

public class InspectorBehavior : System.Attribute,

System.ServiceModel.IServiceBehavior

{

public void ApplyBehavior(

ServiceDescription description,

Collection behaviors)

{

Console.WriteLine("-------- Endpoints ---------");

foreach (ServiceEndpoint endpoint in description.Endpoints)

{

Console.WriteLine("--> Endpoint");

Console.WriteLine("Endpoint Address: {0}",

endpoint.Address);

Console.WriteLine("Endpoint Binding: {0}",

endpoint.Binding.GetType().Name);

Console.WriteLine("Endpoint Contract: {0}",

endpoint.Contract.ContractType.Name);

Console.WriteLine();

}

Console.WriteLine("-------- Service Behaviors --------");

foreach (IServiceBehavior behavior in description.Behaviors)

{

Console.WriteLine("--> Behavior");

Console.WriteLine("Behavior: {0}", behavior.GetType().Name);

Console.WriteLine();

}

}

}

Applying a Custom Behavior

All behaviors can be applied imperatively by adding an instance of the behavior to the ServiceDescription (or the ChannelDescription on the client side). For example, to apply the InspectorBehavior imperatively you would write:


ServiceHost sh = new ServiceHost(typeof(MathService));

sh.AddServiceEndpoint(

typeof(IMath),

new WSHttpBinding(),

"http://localhost/MathService/Ep1");

//Add the behavior imperatively

InspectorBehavior behavior = new InspectorBehavior();

sh.Description.Behaviors.Add(behavior);

sh.Open();

Additionally, behaviors that inherit from System.Attribute may be applied declaratively to the service. For example, because InspectorBehavior inherits from System.Attribute, it can be applied declaratively like this:


[InspectorBehavior]

public class MathService : IMath

{

public int Add(int x, int y)

{ return x + y; }

}

Summary

WCF Services expose a collection of Endpoints where each Endpoint is a portal for communicating with the world. Each Endpoint has an Address, a Binding, and a Contract (ABC). The Address is where the Endpoint resides, the Binding is how the Endpoint communicates, and the Contract is what the Endpoint communicates.

On the Service, a ServiceDescription holds the collection of ServiceEndpoints each describing an Endpoint that the Service exposes. From this description, ServiceHost creates a runtime that contains an EndpointListener for each ServiceEndpoint in the ServiceDescription. The Endpoint's address, Binding, and Contract (representing the where, what, and how) correspond to the EndpointListener's listening address, message filtering and dispatch, and channel stack, respectively.

Similarly, on the Client, a ChannelDescription holds the one ServiceEndpoint with which the Client communicates. From this ChannelDescription, ChannelFactory creates the channel stack that can communicate with the Service's Endpoint.




Window Communication Foundation(WCF)

csharpwithdj.blogspot.com

WINDOWS COMMUNICATION FOUNDATION




OVERVIEW

Windows Communication Foundation takes many existing communication technologies, such as Web Services, Windows Remoting, Microsoft Message Queuing, and abstracts them into a single technology. In most cases, this simplifies the way you communicate with other applications. It also allows you to communicate with other applications without being coupled to a specific technology. Therefore, you could use Web Services over SOAP to begin with, and later move to remote procedure calls (RPC) without changing your code, just the configuration of WCF.

THE BASICS

There are a few basic tasks when creating a WCF service. The basic tasks that must be performed are, in order:



1. Define the service contract. A service contract specifies the signature of a service, the data it exchanges, and other contractually required data.

2. Implement the contract. To implement a service contract, create the class that implements the contract and specify some custom behaviors that the runtime should have.

3. Configure the service by specifying endpoint information and other behavior information.

4. Host the service in an application.

5. Build a client application.



For more information, see http://msdn2.microsoft.com/en-us/library/ms732098.aspx

EXAMPLE

To display a step-by-step enactment of the above steps, let’s define a web service that reports the current date/time:

1.1 DEFINE A SERVICE CONTRACT

First, let’s create a project to house our service contract. Let’s call it WCFDateTime.Service.

1.2 DEFINE A SERVICE CONTRACT

Then, let’s define an interface that represents the service we’re going to provide. In this case, let’s call it IDateTimeService.

public interface IDateTimeService

{

}



1.3 DEFINE A SERVICE CONTRACT

We need to add a method to our service that will return the current date/time:

public interface IDateTimeService

{

DateTime GetCurrentDateTime();

}



1.4 DEFINE A SERVICE CONTRACT

Now, we need to decorate our code with attributes so that WCF will recognize our interface and its methods. Namely, we will add the following attributes:

• ServiceContractAttribute

o Identifies an interface as a WCF service contract

• OperationContractAttribute

o Identifies methods of an interface as WCF service operations, that is, methods that can be called through WCF

using System.ServiceModel;



[ServiceContract]

public interface IDateTimeService

{

[OperationContract]

DateTime GetCurrentDateTime();

}



In order to use the above attributes, you’ll need to add a reference to the System.ServiceModel assembly. The service contract is now ready to be used.



2.1 IMPLEMENT THE CONTRACT

Now that we’ve defined our service contract, we can move on to implementing it. First, let’s create another project to house our server application. Let’s call it WCFDateTime.Server, and make it a Console Application project.

2.2 IMPLEMENT THE CONTRACT

Now, let’s implement the IDateTimeService. The implementation is going to run on our server, to provide the date/time to whoever is going to consume our service.

In the WCFDateTime.Server project, let’s create a class called DateTimeService and have it implement IDateTimeService:

using WCFDateTime.Service;



public class DateTimeService : IDateTimeService

{

}



Remember to add a reference to the WCFDateTime.Service project so you can use IDateTimeService.



2.3 IMPLEMENT THE CONTRACT

The above code will obviously not compile, because we did not implement the GetCurrentDateTime method:

public class DateTimeService : IDateTimeService

{

public DateTime GetCurrentDateTime()

{

return DateTime.Now;

}

}

That’s it! The DateTimeService is now ready to be used.



3.1 CONFIGURE THE SERVICE

Now we need to configure our service so it can be consumed by client applications. The simplest way to accomplish this is by adding an application configuration file (app.config or web.config) to the WCFDateTime.Server project:













address="http://localhost:8081/DateTimeService"

binding="wsHttpBinding"

contract="WCFDateTime.Service.IDateTimeService" />









When defining an endpoint for WCF, remember your A-B-Cs:

1. Address (where)

2. Binding (how)

3. Contract (what)



The address specifies the address where you want the service to be located.

The binding specifies the transport you want to use in order to provide the service.

The contract specifies what service will be provided

4.1 HOST THE SERVICE IN AN APPLICATION

Now that WCF has been configured, the simplest way to host this service is to create a Console Application and use the ServiceHost class. First, add a reference to the System.ServiceModel assembly. Then, In the program.cs file of WCFDateTime.Server, do the following:



using System.ServiceModel;



namespace WCFDateTime.Server

{

class Program

{

static public void Main(string[] args)

{

// Get a host for our service

ServiceHost serviceHost = new ServiceHost(

typeof(DateTimeService)

);



// Open the service host to start listening for incoming requests

serviceHost.Open();



// The service can now be accessed

Console.WriteLine("The service is ready.");

Console.WriteLine("Press to terminate service.");

Console.ReadLine();



// Close the service host

serviceHost.Close();

}

}

}



By simply running this application, we expose our service so that client applications can use it.





5.1 BUILD A CLIENT APPLICATION

To build a client application, we must create a new project for it. Let’s call it WCFDateTime.Client, and make it a Console Application as well.



5.2 BUILD A CLIENT APPLICATION

Now, we need to add an Application Configuration file, and give it some settings that will allow us to connect to the service we just created:











address="http://localhost:8081/DateTimeService"

binding="wsHttpBinding"

contract="WCFDateTime.Service.IDateTimeService"

name="MyDateTimeService">











Now that our we’ve configured our WCF client, we can connect to it. There are two ways to connect to the WCF service we previously created:

1. Client proxy generation

2. Channel factories

Most Microsoft articles will point you in the direction of using client proxies; however, for our purposes, channel factories are quicker to implement and more robust in a Model/View/Presenter architecture.





5.3 BUILD A CLIENT APPLICATION

Now, add a reference to the System.ServiceModel and WCFDateTime.Service assemblies, and then add the following to the program.cs file:

using System.ServiceModel;

using WCFDateTime.Service;



class Program

{

public static void Main(string[] args)

{

// Get a channel factory for our service,

// using the configuration for "MyDateTimeService"

// in the application configuration file.

ChannelFactory channelFactory =

new ChannelFactory("MyDateTimeService");



// Get an instance of our service

IDateTimeService service = channelFactory.CreateChannel();



// Get the server’s date/time

DateTime dt = service.GetCurrentDateTime();



// Write the current server date/time

Console.WriteLine("The current server time is " + dt);



// Close the connection to our service

channelFactory.Close();

}

}



5.4 BUILD A CLIENT APPLICATION

Your client application is now ready to run! Simply start the WCFDateTime.Server application, and once it’s running, run the WCFDateTime.Client application to see it work!



Basics of Window Communication Foundation(WCF)

csharpwithdj.blogspot.com
Basic WCF Concept and Terminologies


Windows Communication Foundation was official released with .NET 3.0 a couple of months ago. For those people who're doing connected, distributed systems or are in any way interested in communication aspects of systems, this ought to be a God-send. WCF basically rolled all the different Microsoft messaging formats into one, making it extremely easy to architect the communication layer of simple to complex applications. This tutorial aims to explain the basic concepts behind the common terminology used in WCF development and design.


WCF Programs

WCF programs are basically divided into 3 different types of programs. They are common known as

• Clients

Clients are program that consumes the services, they are normally the ones that initiate the messenging to the service. Depending on the designed architecture of your application, it is possible that a service behaves as a client as well.

• Services

Services are the programs that offers the services to the consumers. They are the ones that react and process the messages, similar to the backend of the application. They can be viewed as the equivalence of web services in .Net 2.0.

All services have to have endpoints specified in order to work. A good way to remember proper endpoint configurations is ABC. A being Address, B being Binding and C being Contracts.

o Address

Address are the expose points of services. Services have to tell the world that where they are via addresses.

o Bindings

Bindings will describe to the world on how they will communicate with the world. They contain information such as transport way, how they are encoded, are they reliable etc.

o Contracts are of (but not necessary all have to be present) 3 different kinds

 Service Contract

Describes what the service does.

 Data Contract

Define custom messaging structure.

 Message Contract

Define the message format that is passed between services.

• Intermediaries

Intermediaries are programs that act as "middle-man", their basic roles can be similar to providing a firewall, routing, gateway etc. They are commonly invisible to the client and services.

Messages

All services and clients communicate via messages, which are made up of one body, and one or more header. All WCF messages are XML formatted and transport neutral. In other words, you can specify different forms of transport (HTTP, MSMQ, Named Pipes etc) for different messages. Within each application, you can specify different messaging transport depending on the communication needs of the system. Basically, messages can be divided into

• Simplex

One way messaging. Simplex in short means "fire and forget"

• Duplex

Asynchronous two-way messaging. In short this means that once fired, the application will carry on doing its own thing. Upon the return results, it will then handle it.

• Request Reply

Synchronous 2 way messaging. This is the common communicate method whereby you'll fire a request, and wait for the response before continuing.

Channels

Before a client and service can talk to each other, they have to go through a channel. Imagine a channel as a pipe, with one end being the input message and the other end with the results of the message. There're different channels that can be stacked onto each other, they are commonly known as Channel Stacks. They can be of these different types:

• Reliable Sessions

• TCP Transport

• Binary Message Encoder

• Windows Security

• Request Reply

The way in which messages are sent through the pipe (Channel) is known as a Transport and they way at which they are encoded are known as Encodings. Transport can be made up of the following:

• HTTP

• TCP

• MSMQ

• Named Pipes