简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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