WCF connection net.tcp dies after 9 hours, 1 minute

I have a WCF client that is talking to a WCF server (on the same computer). We use netTcpBinding with message-level security (using a custom mainPermissionMode and a custom implementation of serviceCredentials). Service marked with InstanceContextMode.PerSession .

The WCF service is hosted on a Windows service (not in IIS).

To fake keep-alive, we have a Ping method that the client calls every 15 seconds. We keep the client proxy open for the life of the client program (because session initialization is expensive in our case).

Despite this, the connection is rejected after 9 hours, 1 minute and a bit (in 10 test runs, 7 of them died after 9h1m6s).

The only thing that may result in WCF logs is the "SocketConnection aborted" message, followed by a different set of exceptions, but usually including the exception "the connection was in a failed state."

Is there some kind of timeout in WCF or in TCP / IP that causes this? Because I'm at a standstill.

+7
wcf
source share
2 answers

After a lot of tedious investigation: after about 9 hours, the WCF client is re-authenticated by the service. Something I do in the authentication phase is killing an existing session.

+3
source share

From your comments above, you ran tests at the same time.

Were they also on the same server using the same application pool?

If such utilization of the application pool could lead to the fact that all the tests stopped at the same time.

+2
source share

All Articles