开发者

WCF Session Maintenance

开发者 https://www.devze.com 2023-01-31 15:17 出处:网络
I am new to WCF i am trying to implement WCF Session Management but i am not clear about how to implement the session in WCF

I am new to WCF i am trying to implement WCF Session Management but i am not clear about how to implement the session in WCF

This is my CODE

<wsHttpBinding>
   <binding name="wsHttpBinding">
      <reliableSession enabled="true" />
   </binding>
</wsHttpBinding>

[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples", 
SessionMode=SessionMode.Required)]
  public interface IMyService
  {
    ...
  }

This is not working...session is not maintained in my project

Now i wanted to know whether am missing anything or whether i need to add anything else in client or server side???? or this alone is enough to implement the session in my project???

It will be of grea开发者_如何学Got help if someone provide some ideas,suggestions,or sample code for implementing my task...


When you implement your IMyService in a class and a client connects to your service every client gains a new instance of your class. There is a little example, that might help you: http://www.devx.com/architect/Article/40665


How your service will behave depends not just on the SessionMode specified for the ServiceContract, but also on the InstanceContextMode under which your service implementation runs (controlled by the InstanceContextMode property of the ServiceBehavior). There is a helpful table here which tells you what to expect with the various combinations of these settings.

If this doesn't help solve your problem, please explain more specifically what behaviour you are expecting and what you are seeing.

0

精彩评论

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