WCF:如何检测会话是否超时?
我编写此接口来创建和终止会话。
[ServiceContract(SessionMode = SessionMode.Required)]
public interface IOrdersService
{
[OperationContract(IsInitiating = true, IsTerminating = false)]
void EmptyCart();
[OperationContract(IsInitiating = false,IsTerminating = false)]
void AddToCart(CartItem cartItem);
}
工作正常。但是当会话超时时我如何检测?
I write this Interface to create and terminating a session.
[ServiceContract(SessionMode = SessionMode.Required)]
public interface IOrdersService
{
[OperationContract(IsInitiating = true, IsTerminating = false)]
void EmptyCart();
[OperationContract(IsInitiating = false,IsTerminating = false)]
void AddToCart(CartItem cartItem);
}
it`s work fine. But when a session timeout then how can i detect ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它被修剪掉,您的通道在您的客户端和服务器的回调通道上都会出现故障,您可以在通道上侦听故障事件。一旦出现故障,就需要重新创建通道才能恢复。
If it is trimmed out, your channel will be faulted both on your client and your server's callback channel, you can listen on faulted event on channel. And once it is faulted, you will need to recreate a channel to recover.