WCF with wsDualHttpBinding blocking calls

253 views Asked by At

my case is that I'm using wsDualHttpBinding as a binding.

But I've noticed something kind of unexpected. When I try to send a request to a service operation, but my code is handling a callback message (I've put a Thread.Sleep there to simulate), then the service call gets stuck (and can even get timeouted) until the callback message is handled fully. Shouldn't they be independent, or the channel can only handle one message at the time, doesn't matter if it's a service request or a callback message? I'm using the same channel all to time, either to receive the callbacks messages or to send out new requests. This application runs as a service, so there's no UI involved.

1

There are 1 answers

1
Dmitry Harnitski On

Try

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]

It is special mode to support callbacks in single-thread configuration.

http://msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx