WCF how to set infinite inactivity timeout

  • Thread starter Fritz Hilgemann
  • 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
 
R

Roman Wagner

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;
 
R

Rick Lones

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

Heike und Roman Wagner

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top