It seems that WCF TCP connections are not persistent. The first ping answer takes some time, but subsequent processes take less time. After a while, it takes a lot of time - another reconnection?
SERVER> Starts with net.tcp: //0.0.0.0: 999
CLIENT> Connection created in net.tcp: // localhost: 999 // Not a real connection, ready to connect
CLIENT> Reply to Ping in 1s163ms // First connection
CLIENT> Response to Ping in 22 ms // Already connected
CLIENT> Reply to ping in 26 ms
CLIENT> Ping Response in 24 ms
CLIENT> 325 ms Ping Response // Reconnected
CLIENT> Response to Ping in 19 ms
CLIENT> Response to ping in 767 ms // Reconnect
If true, what is the downtime value for a tcp connection before it is disconnected? I need to stay connected online.
Update Modified Code:
NetTcpBinding tcpBind = new NetTcpBinding(); tcpBind.ReliableSession.Enabled = true; tcpBind.ReliableSession.Ordered = true; tcpBind.ReliableSession.InactivityTimeout = TimeSpan.FromMinutes(10); ServiceHost svh = new ServiceHost(typeof(ServiceImplementation)); svh.AddServiceEndpoint( typeof(WCFSimple.Contract.IService), //new NetTcpBinding(), tcpBind, String.Format("net.tcp://{0}:{1}", ip, port)); svh.Open();
Now I got another error:
The http://tempuri.org/IService/Pong action is not supported by this endpoint. Only WS-ReliableMessaging February 2005 messages are processed by this endpoint.
Update I changed only the server side and caused an error. Then I modified TCP on the client side as reliable messaging.