Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is WCF Dispatcher?

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what is WCF Dispatcher". In daily operation, I believe many people have doubts about what WCF Dispatcher is. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is WCF Dispatcher?" Next, please follow the editor to study!

Because WCF is applied in a distributed environment, ServiceMode can be divided into ServiceMode on the client side and ServiceMode on the service side according to the different environment. In terms of implementation complexity, the ServiceMode on the service side is much more complex than that on the client side. For the Service side, the ServiceMode of WCF needs to be solved as follows:

How ◆ creates ChannelListener and listens according to different listening URI

◆ how to create a suitable Channel receiving request message when request arrives

How ◆ distributes Message to the corresponding Endpoint for processing

How ◆ further distributes Message to the corresponding service instance

◆ and how to further distribute the matching method call of the specific service instance.

Because "Dispatch" is its fundamental function and task, Dispatcher is the core of the entire Service-side ServiceMode. As mentioned in the title, WCF Dispatcher is the hub of the entire WCF service mode layer, and this article focuses on the introduction around WCF Dispatcher.

WCF Dispatcher does not refer to a particular object, but refers to a group of related objects that complete the entire dispatch function. This includes three core objects: ChannelListener, ChannelDispatcher, and EndpointDispatcher, and some helper objects.

ChannelListener has been described in detail in the first two parts of this series, and we know that its main function is to bind to a fixed Listening URI to listen for requests from the outside world. Once the request arrives, create a corresponding Channel to receive the Request message. But our business logic is defined in service classes, so WCF must provide a mechanism to activate the corresponding service instance and call the corresponding methods through the message we receive.

There are two types of Activation: creating a new service instance (PerCall instancing mode) and reusing an existing service Instance (PerSession and Singleton instancing mode). The core function of ChannelDispatcher is to provide such a function (although it also provides other useful features, so that the content is not too scattered, it will not be introduced here).

A ChannelDispatcher is usually associated with a ChannelListener, while a ChannelListener corresponds to a fixed listening URI. For a service that is host, different listening address may be defined, so a service generally corresponds to one or more ChannelDispatcher. Furthermore, when we host a service, WCF creates a ServiceHostBase object for it (ServiceHost or your custom object inherited from ServiceHostBase), so a ServiceHostBase object corresponds to one or more ChannelDispatcher objects.

The received request message,ChannelDispatcher will not be processed by itself, but will be distributed to the matching EndpointDispatcher, so most of the functions of dealing with message are actually implemented by EndpointDispatcher. For the same listening address, we usually have more than one endpoint, so a ChannelDispatcher has more than one EndpointDispatcher. For EndpointDispatcher, one thing that definitely deserves a special introduction is DispatchRumtime.

DispatchRumtime matches a specific EndpointDispatcher, and by customizing the DispatchRumtime, you can easily change the runtime behavior of the entire service or a specific Operation according to your specific needs. For an important topic in WCF, WCF extensions, most of your BehaviorExtesionElment is customized to DispatchRumtime through specific Behavior.

At this point, the study of "what is WCF Dispatcher" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report