Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ??

like image 671
Vero009 Avatar asked Feb 19 '26 22:02

Vero009


1 Answers

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.

like image 88
Yuan Avatar answered Feb 21 '26 11:02

Yuan