7
votes

I've got a WCF client talking to a WCF server (on the same machine). We use netTcpBinding with message-level security (using a custom principalPermissionMode and a custom implementation of serviceCredentials). The service is marked with InstanceContextMode.PerSession.

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

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

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

The only thing of consequence in the WCF logs is a "SocketConnection aborted" message, followed by a varying set of exceptions, but usually including a "connection was in the faulted state" exception.

Is there some timeout in WCF, or in TCP/IP, that's causing this? Because I'm stumped.

2
10 test runs, each taking over 9 hours? I admire your patience.Andrew Shepherd
In honesty, that's 2 test runs of 4 clients, and 2 at the same time of 1 client. So only 18 hours, and left overnight, anyway.Roger Lipscombe
If you re-think carefully, 9x3600+60+6<32768, which is 2 power of 15ajreal
Yeah, but not quite, and even so, where is that coming from?Roger Lipscombe

2 Answers

3
votes

After much tedious investigation: After about 9 hours, the WCF client re-authenticates with the service. Something I'm doing during the authentication step is killing the existing session.

2
votes

From your comments above you were running the tests at the same time.

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

If so a recycling of the application pool could have caused all the tests to stop at the same time.