Does WCF perform operations on a Singleton WCF service in the same thread?

I have a service that is marked with the ServiceBehavior attribute

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

Is it likely that operations in this service will be performed by the same thread?

I store important data in the ThreadLocal variable, which should be used to execute the operation once.

+3
source share
2 answers

No,

Each request responds with a different thread. The InstanceContextMode.Single attribute indicates that the service uses the same object (and its members) for each request.

+3
source

, WCF ThreadPool = > Thread , , . , ThreadLocal <T> ThreadStaticAttribute , .

+2

Source: https://habr.com/ru/post/1763454/


All Articles