开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜