Session variable in WCF application

后端 未结 2 948
独厮守ぢ
独厮守ぢ 2020-12-18 04:21

I need to use or stimulate a very simple session object inside my WCF app.

I simply need to store some values at the beginning of a call and I need access to these v

2条回答
  •  甜味超标
    2020-12-18 04:41

    What you're describing (custom context that is retained for the life of a single request) is more like HttpContext.Items than an ASP.NET Session.

    WCF does have a class called OperationContext that is similar to HttpContext. It doesn't have an Items property for custom context, but this blog post describes a technique you can use to achieve what you want.

提交回复
热议问题