WCF follow-up trip (18): Talk about binding

Source: Internet
Author: User

1. Channel layer and Services model layer (Channel Layer and service mode Layer)

For the development and design of a distributed application, communication problem has to be considered and the most complicated and difficult to realize. In the past several years, Microsoft has launched a series of popular communication technologies, such as DCOM, Enterprise service,. NET Remoting, XML Web Service, MSMQ, and so on. These technologies provide their own programming models, freeing developers from tedious, fully-based programming, so that they only need to focus on specific business logic. WCF is all of these communications technology synthesizer, it fully integrates all of these use in different fields, different scenarios of communication technology, provides a unified programming model.

WCF can be divided into two parts: a programming model and a communication implementation, whether functionally or from the hierarchy of the entire infrastructure of WCF. The programming model is provided through the WCF Service Model layer (service mode layer), while the channel layer (channel layer) provides a specific communication implementation. The service model layer is built on the channel layer, and for the average WCF developer, they are only exposed to the service model layer, and the channel layer is blocked.

2. Channel and channel stack (Channel and Channel stack)

WCF communication is based on messages, and the channel layer can be viewed as an intermediary between message exchange participants from the point of view of message exchange. The channel layer forms a continuous channel stack through a channel, and the channel stack constitutes a pipeline of message flow. The sender of the message flows to the receiver of the message through the pipeline, and the recipient of the message handles the message appropriately, generating a new message to be returned to the sender of the message through the pipeline.

However, instead of limiting the functionality of this pipeline through a series of channels to the transmission of messages, the pipeline actually carries many additional functions.

For example, a waterworks, where water may be taken from a natural lake, requires water to be processed before it can eventually flow through a water pipe to the homes of residents. The middle process may be this: The lake is drawn into a pool where impurities are filtered first (we call this the pool), and the filtered water is sterilized in a second pool (we call this the Pool A sterile pool). ; The water is softened in a third pond (we call this the pool A softened pool) and eventually it flows into the homes of the residents through a piped tap.

In fact, we will be the channel stack is equivalent to a waterworks, and the channel stack to form a channel is quite a filter pool, disinfection pool, softening pool and water pipes. The only difference is that the waterworks deals with water, and the channel stack deals with messages. The greatest benefit of this design is that it is highly scalable, because we can not, and do not need to design a channel to do all the message processing tasks, we need to do is only a channel to focus on a certain function of the implementation, through the rational combination of channels to achieve our actual message processing functions.

For a waterworks, the ultimate purpose of their own production of water to allow consumers to drink, so the water pipeline is necessary, as for the middle of the link, filtration, disinfection, softening 、......, may be in good water quality is not necessary. Similarly, for a channel stack, there are two channels that are required: the transmission channel (transport channel) and the Message encoding channel (Messages encoding channel). The reason is very simple, the purpose of the channel stack is to realize the transmission of messages, transmission channel is definitely necessary, and the premise of transmission, the need for a reasonable message coding, such as based on text encoding and binary coding. As shown in the following illustration:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.