开发者

OperationContext.Current is null and all other contexts too

I have a WCF service defined as following:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerCall)]
public partial class FrontEndService : IFrontEndService

Howev开发者_如何学Cer, most of the time (but not always) InstanceContext.Current is null, as well as HttpContext.Current and OperationContext.Current is also null.

What am I missing? What I want to do is store some data in HttpContext.Current.Items or a similar collection that exists for the length of the request.


The service was just being called from another thread, and not via HTTP, that's why all Contexts were null.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜