dzendras dzendras - 1 year ago 169
C# Question

Changing ConcurrencyMode

I'm using Castle Windsor WCF Facility.
The docs say:

If you are switching from WCF activation to Windsor's WcfFacility, please make sure to remove the ServiceBehavior attribute from service type.

How can I then control the concurrency mode?

In vanilla WCF I'd do:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]

It seems that with WCF Facility the concurrence mode is set to Single and I can't find a way to change it.

EDIT: The client calls asynchronously BeginFoo method and the call is not blocking on client side.
I put logging at the beginning and at the end of the BeginFoo method. The logs indicate that the server call enters and exits BeginFoo method only once at a time.

The following client calls get magically queued.

Answer Source

I figured it out.

If you don't specify the attribute, then WCF Facility creates one for you and adds it to


So the solution is to add an attribute to Behaviors collection (Yes, the attribute implements IServiceBehavior, a bit counterintuitive though...) and set the relevant properties there.

I'm adding the behaviors in WcfServiceModel's extension OnCreated. As at this point the default behavior is already there, I had to remove it first.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download