This operation would deadlock because the reply cannot be received until the current Message completes processing.
March 31, 2011
Posted by on
I got the following exception when I attempted to create a Duplex channeled service.
This operation would deadlock because the reply cannot be received until the current Message completes processing. If you want to allow out-of-order message processing, specify ConcurrencyMode of Reentrant or Multiple on ServiceBehaviorAttribute.
I got this exception because I didn’t change the concurrency mode of the service. By default the concurrency mode is single. But the duplex operation would require the service instance to be called concurrently.
As suggested in the exception message itself, when I set the Concurrency mode to Multiple it got resolved.
Reentrant is also applicable for duplex services however the choice of Multiple or Reentrant concurrency is up to the design.
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class GreetingService : IGreetingService