Blog from Saravanan Arumugam

Let us talk about Technologies

This operation would deadlock because the reply cannot be received until the current Message completes processing.


I got the following exception when I attempted to create a Duplex channeled service.

Exception

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.

Solution

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: