WCF Note—Operation Selector

本文探讨了WCF服务中OperationSelector的作用及其工作原理。文章介绍了当WCF服务启动后,如何创建ChannelDispatcher并利用AddressMessageFilter和ContractMessageFilter传递消息到EndpointDispatcher。此外,还解释了如何通过OperationSelector来确定消息对应的具体操作。

i have no enthusiasm to write blogs those days,but i still believe that writing can enrich and help my memory,so make a note about what i am learning.today’s topic is WCF Operation Selector.following is a brief description.

after the wcf service is hosted.it will create a ChannelDispatcher(ps:how many ChannelDispatchers will be created,which depends on how many listenUrls the service has.there is only one listenUrl today,so there is only one ChannelDispatcher).as we know every ChannelDispatcher has a corresponding ChannelListener(it is very important but not today’s topic,if time is enough,i will describe in another post).

now ChannelDispatcher is available,it is time that the ChannelDispatcher showed its function.ChannelDispatcher will transfer the mesage to the EndointDispacher with the help of AddressMessageFilter and ContractMessageFilter(maybe we can find somtheing from their names ).At the same time,ChannelDispatcher also creates a collection named as DispachOperation in which all operations of the current endpoint are included.

So we have an operation collection,but how the message reaches the very expected operation.there is another object,OperationSelector(we can also find somthing from it name), which can return the very expected operation by analyzing the mesage(how? i also need help? can you?).

Now,you may find that it is impossible for a WCF service to have two operations which have the same name.if that,how the OperationSelector works?

There will be another question,if we cannot have a service with two operations which have the same name,it means that we cannot overload the method in a service.frankly speaking.it is true.you know,wcf is designed for SOA,but WCF Service is also programmed by OOP language(like C#).how do we fix this conflict? is there any solution for this conflict? the anwser is true.we can use the attribute to update the operation’s default name. a simple code.

 [ServiceContract]
    public interface IOverLoadDemo
    {
        [OperationContract(Name = "AddDouble")]
        double Add(double p1, double p2);

        [OperationContract(Name = "AddInt")]
        int Add(int p1, int p2);
    }

PS:windows live writer 2011 is better than previous version

转载于:https://www.cnblogs.com/sanjia/archive/2011/02/16/WCF_Not_Operation_Selector.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值