WCF - Binding.ReceiveTimeout & ReliableSession.InactivityTimeout

6.8k views Asked by At

I am trying to make a WCF service which uses callbacks to the client. I would like the channel to be kept open as long as there is a connection (internet, network) and either the client or channel have not explicitly closed the channel.

In order to keep the channel open (even without activity) I found the reliable sessions that WCF supports. I see that by using reliable sessions, there are two timers which one needs to take into consideration: the Binding.ReceiveTimeout and the ReliableSession.InactivityTimeout.

After searching on the internet, I am still unable to understand exactly how these two work together. I know that if either of the two times out, the connection goes into faulted state.

My first question: What exactly happens when reliable sessions are enable?

My second question: Here, why does msdn say the following?

Since the connection is dropped if either inactivity timer fires, increasing InactivityTimeout once it is greater than ReceiveTimeout has no effect. The default for both of these timeouts is 10 minutes, so you always have to increase both of them to make a difference when using a reliable session.

1

There are 1 answers

3
SwissCoder On BEST ANSWER

To get an answer for your first question, have a look at the nice answer to this question:

What is the purpose of WCF reliable session?

To my the explanation on the msdn site is clear: When the time specified in ReceiveTimeout(for example 10 minutes) is reached, it will end the connection, even if the reliable session has a keep alive beeing sent (for example every 1 minute).

The keep alive beeing sent every minute would make sure the inactivityTimout (for example 5 minutes) is never reached -therefor the channel would be kept open endlessly-, but after the time speciefied in ReceiveTimeout the session/channel still will be closed.

So ReceiveTimeout should always be higher or the same as inactivityTimeout, as far as I understand.