I have a WCF service with ConcurrencyMode = ConcurrencyMode.Multiple option. Can I safely read incoming request HTTP headers and set outgoing response ones considering the fact that service requests are processed concurrently? I doubt because WebOperationContext.Current is a global state. Does it check current thread?
I have a WCF service with ConcurrencyMode = ConcurrencyMode.Multiple option. Can I safely read
Share
ConcurrencyMode.Multiplemake sense only if you have instancing which allows sharing the service instance. In case of REST service you most probably doesn’t have such instancing (unless you are using singleton service) and you should not have such instancing (because REST service doesn’t maintain state – all state is transferred in the request).REST service uses per request instancing and each request is served by a new thread (from thread pool) and new instance of the service class automatically. You don’t need this setting at all.
WebOperationContext.Currentretrieves current context from private thread static variable inside the context so it is not shared among threads.