What is the main difference between Request-Response and Duplex in WCF Message Exchange Pattern?
In the request/reply and one-way message exchange patterns, only the client can initiate communication. In the duplex pattern, both the client and the service can initiate communication.
The three basic message exchange patterns. Top to bottom: datagram, request-response, and duplex. Each of these MEPs can also support sessions.
The default message exchange pattern is request-reply in WCF. The client only sends the request to the service and it will not wait for the response back from the service. The client will not get any exceptions if it is occurring during the service processing it, because the client is not waiting for the result here.
Even if some error occurs in communication, WCF Service doesn't send any response back. That's why One-Way Message Exchange Pattern provides no support for followings in service operations: no output parameters. no reference parameters.
The main difference is that, after the client establishes a channel to the service, the service can call the client independently at any time. In Request-Response the service only communicates back after receiving a Request from the client. So by using duplex you receive an event-like behavior from the client perspective. Obviously such enhancement requires a Session to be maintained (instance mode PerSession
on the service). You can read more on the msdn.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With