"WCF Technology Insider" translation 19:1th Part _ 4th Chapter _WCF101: Analysis WCF and this chapter summary from the inside

Source: Internet
Author: User

Analyze WCF from the inside

When examining the outside of a WCF program (address, binding, and contract), it is natural to wonder how WCF uses addresses, bindings, and contracts to send and receive messages. The code we see so far has very little code that is directly related to sending and receiving messages. In fact, the address, bindings, and contracts themselves do not do much of the actual work. When we looked at the WCF program, we saw another infrastructure that used addresses, bindings, and contracts to send and receive messages. From a large level, the remainder of this book will focus on explaining the underlying infrastructure, so we'll introduce the main part of the underlying infrastructure in this chapter.

When we read the entire address, bindings, and contracts, we found that there were actually only 2 major architectural layers of the infrastructure. These 2 levels of names are the service model layer (ServiceModel layer) and the channel layer (Channel layer) respectively. The service model layer is the bridge between the user code and the channel layer. In other words, it is part of the standard API. Channel layer, in other words, to do the real news related work. The channel layer is the layer that knows the specific transmission mode and ws-* message orchestration. WCF has a rich channel-level capability. Typically, the channel layer is the programming area of the underlying infrastructure developer, so it is entirely possible to write a fully functional WCF program without using the channel layer code.

Note: Although this division is a bit simpler, I divide the developers into 2 categories: application developers and infrastructure developers. The application developer writes the application code, and the infrastructure developer writes the code used by the application developer. An application developer might develop an order processing system, while an infrastructure developer might develop a reusable component that is used by the order processing system. In WCF, application developers write messaging applications, but infrastructure developers write custom channels.

Figure 4-2 illustrates how the service layer and channel layer work together

Figure 4-2: Service layer and channel layer

Note that the service model layer invokes the agent on the sender (proxy, also known as client) and the Distributor on the receiver (Dispatcher). Agents and distributors have different roles, although they are different parts of the same architectural layer. The agent is responsible for creating the message and sending it to the channel layer. The Distributor, in other words, is responsible for deserializing the received message, instantiating the object, and distributing the deserialized message content to this object. Agents and distributors have more work to do than other objects, and we will describe their role in the 10th chapter in detail.

The service model layer and the channel layer differ from the address, binding, and contract scope. In effect, part of the address, binding, and contract application developer APIs, which can affect these 2 tiers. When you first touch the WCF layer, it is useful to figure out the level of address, binding, and contract action. On the message receiver, the address tells the channel to listen for the address of the request message. On the sender, the address tells the channel message recipient's address. binding, in other words, is a collection of factory objects that create the channel layer. Contracts are used for message serialization and deserialization, and they are also used to determine the message Exchange Mode (MEP) of the accepted program. Generally speaking, a contract is the structure of a service model layer. Behavior (behaviors), in other words, can affect the service model layer and the channel layer. Figure 4-3 as shown in the figure:

Figure 4-3:abc How to affect the service model layer and channel layer

Summary of this chapter

In this chapter, we build a simple WCF program and break it down into several major run-time components. We see a developer-oriented WCF API that is simple and flexible. We also see addresses, bindings, contracts, and behavior, providing the WCF2 of the main architectural layers: the service model layer and the channel layer, and the APIs used. The remainder of this book will detail these 2 levels.

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.