WCF TCP接続は永続的ではないようです。最初のping応答にはしばらく時間がかかりますが、それ以降のプロセスには時間がかかりません。しばらくするともう一度もう一度やり直しますか?永続的なTCP接続の作成/シミュレート方法は?
SERVER> Started on net.tcp://0.0.0.0:999
CLIENT> Connection created to net.tcp://localhost:999 //Not a real connection, ready to connect
CLIENT> Ping reply in 1s163ms //First connection
CLIENT> Ping reply in 22ms //Already connected
CLIENT> Ping reply in 26ms
CLIENT> Ping reply in 24ms
CLIENT> Ping reply in 325ms //Re-connected
CLIENT> Ping reply in 19ms
CLIENT> Ping reply in 767ms //Re-connected
trueの場合、接続が切断される前にtcp接続のアイドル時間値はどのくらいですか?私は接続を生かしておく必要があります。コード修正
更新:私は、サーバー側のみを変更し、それがエラーの原因となった更新
The action http://tempuri.org/IService/Pong is not supported by this endpoint. Only WS-ReliableMessaging February 2005 messages are processed by this endpoint.
:
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();
は今、私は別のエラーを得ました。次に、クライアント側のTCPを信頼性の高いメッセージングとして変更しました。
現実世界のテスト:3秒間隔でping応答は約100msです。間隔が60sの場合、返信は〜500msプラス1s520ms(再接続可能) –
私はそのタイムアウトを有効にする必要があると思う:reliableSession> enable = true; inactivityTimeout = 10秒; –