0

I have a WCF service using WebHttpBinding.

I use the following configuration:

InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple

I have limited the MaxConcurrentCalls to 20.

What I see is the following: if the limit of 20 is reached, new connections/requests are queued. How can I achieve that something like a "service busy" message is send instead?

Many thanks

koche012
  • 1
  • 1

2 Answers2

1

I think in such case it's better for the client to deduce that the service is busy with a time-out for the request, instead of the service failing with an error code.

Hasan Baidoun
  • 1,095
  • 9
  • 18
0

The "service busy" is the result of WCF failing to process a message. I'm not sure why you would prefer a failed request over one that might take a little longer to successfully process. Also, WCF exposes service throttling parameters but I don't believe you can directly configure the built-in WCF queuing mechanism.

Even for a singleton configuration (maxConcurrentCalls="1" or InstanceContextMode.Single) like you've shown, throttling is also affected by two other parameters (maxConcurrentSessions and maxConcurrentInstances) not just concurrent calls. This article has a good overview of the effect of the three parameters involved. By tweaking these and possibly a timeout setting you can probably force the "service busy" condition if that is really what you need.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51