Explain WCF Architecture.

WCF is a layered architecture which provides developers a new service-oriented programming model, is dis- cussed in detail in the following sections.

WCF Architecture

WCF Architecture

Contracts WCF contracts are much like a contract that you and I would sign in real life. Acontract I may sign could contain information such as the type of work I will perform and what information I might make avail- able to the other party. A WCF contract contains very similar information. It contains information that stipulates what a service does and the type of information it will make available.
there are three types of contracts: data, message, and service.
Data A data contract explicitly stipulates the data that will be exchanged by the service. The service and the client do not need to agree on the types, but they do need to agree on the data contract. This includes parameters and return types.
Message A message contract provides additional control over that of a data contract, in that it controls the SOAP messages sent and received by the service. In other words, a message contract lets you customize the type formatting of parameters in SOAP messages.
Most of the time a data contract is good enough, but there might be occasions when a little extra control is necessary.
Service A service contract is what informs the clients and the rest of the outside world what the endpoint has to offer and communicate. Think of it as a single declaration that basically states “here are the data types of my messages, here is where I am located, and here are the protocols that I communicate with.”
Policy and Binding Policy and binding contracts specify important information such as security, protocol, and other information, and these policies are interrogated looking for the things that need to be satisfied before the two services start communicating.
Service Runtime The Service Runtime layer is the layer that specifies and manages the behaviors of the service that occur during service operation, or service runtime (thus “service runtime behaviors”). Service behaviors con- trol service type behaviors. They have no control over endpoint or message behaviors. Likewise, end- point and message behaviors have no control over service behaviors.

The following lists the various behaviors managed by the Service Runtime layer:

Throttling Behavior: The Throttling behavior determines the number of processed messages.
Error Behavior: The Error behavior specifies what action will be taken if an error occurs during service runtime.
Metadata Behavior: The Metadata behavior controls whether or not metadata is exposed to the outside world.
Instance Behavior: The Instance behavior drives how many instances of the service will be available to process messages.
Message Inspection: Message Inspection gives the service the ability to inspect all or parts of a message.
Transaction Behavior: The Transaction behavior enables transacted operations. That is, if a pro- cess fails during the service runtime it has the ability to rollback the transaction.
Dispatch Behavior: When a message is processed by the WCF infrastructure, the Dispatch Behavior service determines how the message is to be handled and processed.
Concurrency Behavior: The Concurrency behavior determines how each service, or instance of the service, handles threading. This behavior helps control how many threads can access a given instance of a service.
Parameter Filtering: When a message is acted upon by the service, certain actions can be taken based on what is in the message headers. Parameter Filtering filters the message headers and executes preset actions based on the filter of the message headers.

Messaging The Messaging layer defines what formats and data exchange patterns can be used during service com- munication. Client applications can be developed to access this layer and control messaging details and work directly with messages and channels.
The following lists the channels and components that the Messaging layer is composed of:
WS Security Channel: The WS Security channel implements the WS-Security specification, which enables message security.
WS Reliable Messaging Channel: Guaranteed message delivery is provided by the WS Reliable Messaging channel.
Encoders: Encoders let you pick from a number of encodings for the message.
HTTP Channel: The HTTP channel tells the service that message delivery will take place via the HTTP protocol.
TCP Channel: The TCP channel tells the service that message delivery will take place via the TCP protocol.
Transaction Flow Channel: The Transaction Flow channel governs transacted message patterns.
NamedPipe Channel: The NamedPipe channel enables inter-process communication.
MSMQ Channel: If your service needs to interoperate with MSMQ, this is the channel that enables that.

Activation and Hosting The Activation and Hosting layer provides different options in which a service can be started as well as hosted. Services can be hosted within the context of another application, or they can be self-hosted. This layer provides those options.
The following list details the hosting and activation options provided by this layer:
Windows Activation Service: The Windows Activation Service enables WCF applications to be automatically started when running on a computer that is running the Windows Activation Service.
.EXE: WCF allows services to be run as executables (.EXE files).
Windows Services: WCF allows services to be run as a Windows service.
COM+: WCF allows services to be run as a COM+ application.

1 thought on “Explain WCF Architecture.

Comments are closed.