How System.ServiceModel.Web.WebOperationContext works when InstanceContextMode is Single?
If my WCF Service has this attribute:
[ServiceBehavior(
InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
How can the following a Singleton work in a call?
System.ServiceModel.Web.W开发者_JAVA百科ebOperationContext.Current
I'm not sure what you're asking exactly... but the operation contexts in WCF (all of them) get tied by default to the execution thread, so whenever you access it (as long as it's within the processing of a WCF request) you'll get the context associated with that requests.
Obviously, your singleton should handle multiple concurrent requests, and it will have access to each request's operation context in the right thread. In other words, most of the time it should just work as expected.
精彩评论