Session variable in WCF application

后端 未结 2 947
独厮守ぢ
独厮守ぢ 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:50

    You have to do a couple of things.

    Set aspNetCompatibilityEnabled = true on your host (inside system.ServiceModel | serviceHostingEnvironment)

    The service (not the contract) - should be attributed with:

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    

    Finally you have you have to set allowCookies on your binding to true.

    
     
    
    

    Just curious, are you certain you need session?

提交回复
热议问题