简体   繁体   English

具有PerSession的WCF服务的行为类似于PerCall

[英]WCF Service with PerSession acts like PerCall

My service: 我的服务:

 [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
    public class Service1 : IService1
    {
        int i = 0;

        public int Add(int value)
        {
            i += value;

            return i;
        }
    }

With the interface: 使用界面:

[ServiceContract]
public interface IService1
{

    [OperationContract]
    int Add(int value);
}

Everytime I call the Add method the variable i gets reset to 0. (I tested it with WCF Test Client and a ChannelFactory) 每次调用Add方法时,变量都会重置为0。(我使用WCF测试客户端和ChannelFactory对其进行了测试)

I use a BacisHttp binding. 我使用BacisHttp绑定。

What did I do wrong? 我做错了什么?

Do i have to config the WCF Test Client and the ChannelFactory? 我是否需要配置WCF测试客户端和ChannelFactory?

我是白痴:BacisHttpBinding不支持会话

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM