I have simple WCF service hosted on Windows Service.
When the client of wcf service is idle for 10 minutes or more WCF service terminated at client side [ not at server side, server service is still alive] and i got famaous time out error.
I do not want to increase timeout time . I just wanted to know is there is an elagant way to know if a service is terminated or not at client side?[ Does API provides this info?] Then If session terminated i will create new one.
Best Wishes
Ps: At client side i checked WCFClientChannel->Sate == CommunicationState::Faulted
and this does not worked
Unfortunately the only way to know that a proxy is no longer usable is to attempt to use it.
What's actually happening is you are using a binding which is sessionful (say NetTcpBinding or WSHttpBinding) for which the service maintains resources for the client connection. If the client doesn't talk to the service for the amount of time specified in the service's receiveTimeout (default 10 minutes) then the server decides the client isn't coming back and throws away the client's server side resources.
Now when the client comes back and says "hey its me again" the server says "I have no idea what you're talking about" and faults the call thus killing the clients proxy
Therefore, as the decision has been taken server side, there is no way the client will know unless it tries to talk to the service
You could do one of the following: