开发者

WCF - IDuplexSessionRouter VS IRequestReplyRouter

I'm having 70-513 exam soon. There is a question in the dump that i don't understand.

A WCF service implements a contract with one-way and request-reply operations. The service is exposed over a TCP transport. Client use a router to communicate with the service.

The answer said using IDuplexSessionRouter instead of IRequestReplyRouter. Can i know why cannot use 开发者_StackOverflowIRequestReplyRouter??


That question is covered in this msdn article: Building a router (look for "Routers and Transport Sessions" section there)


The Routing Service uses contracts that define the shape of the channels used to receive and send messages, and therefore the shape of the input channel must match that of the output channel.

So if you perform routing to endpoints that use the request-reply channel shape, then you must use a compatible contract on the inbound endpoints, such as the IRequestReplyRouter.

This means that if your destination endpoints use contracts with multiple communication patterns (such as mixing one-way and two-way operations) you cannot create a single service endpoint that can receive and route messages to all of them. A workaround is to use a duplex contract at the Routing Service such as IDuplexSessionRouter.

References:

http://msdn.microsoft.com/en-us/magazine/cc546553.aspx

http://msdn.microsoft.com/en-us/library/ee517422.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜