An Overview Of WCF Architecture

WCF is composed of a layered architecture which provides an easy way to build different types of distributed applications. The architecture of the WCF system is indicated in the picture.
You can see four layers in the picture.
  • Contracts
  • Service Runtime
  • Messaging
  • Activation and Hosting 
It is located just below the application layer and includes information that defines the service operation and the types for which the information will be available. WCF distinguishes four types of contracts,
  1. Service contracts
  2. Data contracts
  3. Message contracts
  4. Contracts of errors
Service Runtime 
This layer is located just below the layer of the contract. It defines different service deeds during execution. There are many types of behavior that belong to the layer Service Runtime. They are:
  • Throttling Behavior        -   manages the number of specific messages.
  • Error Behavior               -  defines the result that will be generated in case of an internal server error.
  • Metadata Behavior        -  defines the availability of metadata to the outside world.
  • Instance Behavior         -  defines the number of instances that will be available to the client.
  • Transaction Behavior    -  enables transactional execution of operations.
  • Dispatch Behavior         -  controls how the messages will be generated by the WCF infrastructure.
  • Concurrency Behavior   -  controls the functions that are executed in parallel.
  • Parameter Filtering        -  validates the parameters of the method before such methods are called.
It consists of several channels that form the content of a message that is exchanged between the two communication points. The channel set jointly builds the channeled channel of the channel, and the two most important types of channels that can build the mentioned stack are,
  • Transport Channels -   are located at the bottom of the stack and are responsible for sending and receiving messages using transport protocols such as HTTP, TCP, P2P, Named Pipes and MSMQ.
  • Protocol Channels   - are at the top of the stack and are responsible for the implementation of security, transaction, and reliability when messaging. Protocol channels transform and modify a message to make it compatible with the conductor layer.
Activation and Hosting 
The last layer of WCF architecture is the location where the services are located, and from which customers can consume them. Activation and hosting can be achieved in several different ways, by using:
  • IIS  - hosting using the IIS server.
  • Windows Activation Service (WAS)  - it allows hosting services with which it can communicate not only using the HTTP protocol
  • Self-Hosting  - the mechanism by which the WCF service is hosted within an application whose host logic needs to be written independently. This is an approach that provides immense flexibility for protocol and addressing.
  • Windows Service - service can be hosted and using Windows service.