WCF - IDuplexSessionRouter VS IRequestReplyRouter

I will have a 70-513 exam soon. There is a question in the dump that I do not understand.

The WCF service implements a one-way and request-response contract. The service is provided via TCP transport. The client uses the router to communicate with the service.

The response is indicated using IDuplexSessionRouter instead of IRequestReplyRouter. Can I find out why IRequestReplyRouter cannot be used?

+6
source share
2 answers

This issue is addressed in this msdn article: Building a Router (find the Routers and Transport Sessions section there)

+3
source

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 the shape of the output channel.

So, if you are routing to endpoints using the request-response channel form, then you should use a compatible contract on incoming endpoints, such as IRequestReplyRouter.

This means that if destination endpoints use contracts with multiple communication patterns (for example, mixing one-way and two-way operations), you cannot create one service endpoint that can receive and forward messages to all of them. A workaround is to use a duplex contract in a routing service such as IDuplexSessionRouter.

Literature:

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

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

+1
source

Source: https://habr.com/ru/post/897565/


All Articles