WCF Reliable Session Timeout
        Posted  
        
            by RemotecUk
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by RemotecUk
        
        
        
        Published on 2010-03-15T01:24:20Z
        Indexed on 
            2010/03/15
            1:29 UTC
        
        
        Read the original article
        Hit count: 897
        
Hi, when do reliable sessions time out?
My session class is defined as follows:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
and in my app.config...
<bindings>
      <netTcpBinding>
        <binding name="FTS_netTcpBinding">
          <reliableSession enabled="true" inactivityTimeout="00:00:30"/>          
        </binding>        
      </netTcpBinding>           
    </bindings>
I have put a timer in the constructor of my session class that simply outputs a count (1..2..3...) to the console for every second the session is active.
I have tested it so far by faulting my channel. I would have imagined that the session class would have died after ~30 seconds (as specified in my inactivityTimeout parameter) and hence the timer would have died. However it was still going after a minute.
Each session on my app will have significant resources so I need to make sure that they are cleaned up when something goes wrong.
Thanks.
© Stack Overflow or respective owner