我创建了一个带有回调的服务。这工作正常。现在我想让这项服务持久。我的问题是获取上下文并稍后再次加载。我这样称呼服务:
class UserManagementProxy : IUserManagementCallback, IDisposable
{
IUserManagement pipeProxy = null;
public InfoMessage Login(string username, string password)
{
DuplexChannelFactory<IUserManagement> pipeFactory = new DuplexChannelFactory<IUserManagement>(new InstanceContext(this), new NetTcpContextBinding(), new EndpointAddress(Properties.Settings.Default.Adress));
InfoMessage message = null;
try
{
pipeProxy = pipeFactory.CreateChannel();
LoginResult result = pipeProxy.Login(Guid.Parse("b06cbb6f-1c99-4e02-91a7-f7d778b29790"), username, password);
return result.Status;
}
catch (Exception ex)
{
}
}
}
我现在必须在哪里保存上下文,我该怎么做?我试图用客户群做一些事情......但我认为这是另一种解决方案。再次访问同一服务实例的正确方法是什么?
感谢您的帮助,马克斯