简体   繁体   English

WCF:如何检测会话超时?

[英]WCF : How to detect a session is timeout?

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 ?? 但是当会话超时时,我怎么能检测到?

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. 一旦出现故障,您将需要重新创建一个恢复通道。

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

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