views:

20

answers:

1

Hi !

I'd like to know if it's possible to call a method on a WCF windows service while another one is executing ? I need this so I can call my Terminate method that sets a static variable shared by my threads that tells them to stop. But when I call the method on the service, it waits till the first one (Execute) is over before he takes the call...

+1  A: 

You need to set the concurrency mode of the service behavior to ConcurrencyMode.Multiple like this:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
class MyService : IMyContract
{
    // ...
}

In this situation the framework will not try to synchronize access to the service instance allowing to execute multiple operations at the same time.

Gart