WCF how to set infinite inactivity timeout

  • Thread starter Thread starter Fritz Hilgemann
  • Start date Start date
F

Fritz Hilgemann

Hello,

I have a WCF service and client (duplex) where the client is mainly waiting
for events via the callback. Unfortunately, it suffers from timing out,
since it does not call a dummy function once in a while. So, I would like to
change the inactivity timeout to infinite.
All I found how to do this in the configuration file. BUT: I am
intentionally not using a config file. Instead, I code the service behaviour
directly.
tcpBinding.ReliableSession.InactivityTimeout =
The point is, it accepts a TimeSpan, but appearently, Timespan does not
support "infinite".
Any ideas how to accomplish this infinite behaviour programatically?

Regards,
Fritz
 
Hello,

in ou project we use the following Binding and works perfectly.
<netTcpBinding>
<binding name="netTcpBinding"
receiveTimeout="Infinite">
<reliableSession inactivityTimeout="00:00:10"
enabled="true" />
</binding>
</netTcpBinding>

This is equal to the following code

binding.ReliableSession.Enabled = true;
binding.ReliableSession.InactivityTimeout =
TimeSpan.FromSeconds(10);
binding.ReceiveTimeout = TimeSpan.MaxValue;
 
Fritz said:
Hello,

I have a WCF service and client (duplex) where the client is mainly waiting
for events via the callback. Unfortunately, it suffers from timing out,
since it does not call a dummy function once in a while. So, I would like to
change the inactivity timeout to infinite.
All I found how to do this in the configuration file. BUT: I am
intentionally not using a config file. Instead, I code the service behaviour
directly.
tcpBinding.ReliableSession.InactivityTimeout =
The point is, it accepts a TimeSpan, but appearently, Timespan does not
support "infinite".
Any ideas how to accomplish this infinite behaviour programatically?

Regards,
Fritz

TImeSpans can be huge. Are you saying that an inactivity timeout of, e.g., a
thousand years would somehow not work for you here?
 
Hello! do you specify this information on the clientside config file?

the binding must be the same on client and server. It is locatet in
<system.serviceModel><Bindings>
please use the WCF-configuration tool to edit these settings
 
Back
Top