views:

41

answers:

1

I have a service which is defined as ConcurrencyMode.Single:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,
    UseSynchronizationContext = false,
    InstanceContextMode = InstanceContextMode.PerSession,
    IncludeExceptionDetailInFaults = true)]
public class MyService : IMyService

This service provides a method to tell the client what it's currently working on:

    [OperationContract]
    string GetCurrentTaskDescription();

Is there a way to make this particular method allowable while another long-running task is running where all other methods still follow the single-threaded concurrency model?

+4  A: 

You can't make methods have an instance context mode.

If you really need a single threaded set of calls and one multithreaded set of calls you will need to create a new service contract for this call.

Spence
or make the whole service multi-threaded and synchronize all other methods manually
Vitalik
Thats a good point. I guess the onus is on the developer to get that right though.
Spence