Threading, ConcurrencyMode, and UseSynchronizationContext Clarifications

I have a WCF service running in a WPF application.

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]

This WCF is a logging service that means there are no multithreaded problems, all calls should be fast and not answer (the client has IsOneWay, and the binding is NetNamedPipes).

From what I understand:

InstanceContextMode.Single . So this class is in singleton, there is only one instance. and all challenges reach this class.
ConcurrencyMode.Multiple . Each call to this service will be in a new / different thread.

When I set these 2 settings, all calls are created from the GUI thread, only after I added UseSynchronizationContext = false - calls made from other threads.

My question is: if I do not want to register through the GUI thread, why do I need to define both ConcurrencyMode and UseSynchContext? Am I missing something using these settings? Why is ConcurrencyMode not enough (because its wpf application?)

thanks

+4
source share

All Articles