koche012
koche012

Reputation: 1

Throttling WCF WebHttpBinding

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

Upvotes: 0

Views: 1342

Answers (2)

Hasan Baidoun
Hasan Baidoun

Reputation: 1155

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.

Upvotes: 1

Sixto Saez
Sixto Saez

Reputation: 12680

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.

Upvotes: 0

Related Questions