[ServiceContract]
public interface IService1
{
[OperationContract]
string AddData(int value);
}
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]
internal class Service1 : IService1,IDisposable
{
private int acc;
public Service1()
{
acc = 0;
}
public string AddData(int value)
{
acc += value;
return string.Format("Accumulator value: {0}", acc);
}
#region IDisposable Members
public void Dispose()
{
}
#endregion
}
我正在使用启用可靠会话标志的默认配置的Net.TCP绑定。
据我所知,这样的服务在会话模式下应该不会出现问题。
你知道为什么会这样吗?也许我错过了什么?
更新:我注意到了
here
wcftestclient不维护与客户端的会话-可能是我的问题。事实上,这就是问题所在。从简单控制台客户端连接到该服务,确认该服务正常工作。