我在控制台应用程序和WPF客户端中有一个signalR集线器。 启动时,signalR连接初始化,并应始终保持活动状态。 每秒的消息会从服务器推送到客户端与当前SYSTEMTIME(这是什么,你可以用“SystemTimeUpdateNotification”的日志中看到)SignalR客户端由于不活动而停止连接
我现在描述的行为是一个Windows7的设备:每一次,一会儿我发现客户端失去了与服务器的连接。 由于某些原因,客户端检测到它已被停用并停止连接。我不知道'4/20/2017 3:04:06 AM'和'timeout 00:00:50'是从哪里来的。 如果我在同一时间检查服务器上的日志,我可以看到没有Keepalive消息。
2017-04-20 05:04:04.0728,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:04:05.0859,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:04:06.0999,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:05:13.1020,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:05:14.1160,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:05:14.5511,Info,The client has been inactive since 4/20/2017 3:04:06 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 2017-04-20 05:05:14.5871,Info,SignalR connectionstate changed from 'Connected' to 'Disconnected' 2017-04-20 05:05:14.5871,Trace,Received notification NotificationConnectionStateChanged 2017-04-20 05:05:14.5981,Info,Disconnecting... 2017-04-20 05:05:14.5981,Info,Cancel ongoing operations 2017-04-20 05:05:19.6104,Info,SignalR connectionstate changed from 'Disconnected' to 'Connecting' 2017-04-20 05:05:19.6104,Trace,Received notification NotificationConnectionStateChanged 2017-04-20 05:05:19.6104,Info,Disconnecting... 2017-04-20 05:05:19.6454,Info,SignalR connectionstate changed from 'Connecting' to 'Connected' 2017-04-20 05:05:19.6454,Trace,Received notification NotificationConnectionStateChanged 2017-04-20 05:05:19.6454,Info,Connecting... 2017-04-20 05:05:19.6524,Debug,Performing client/server compatibility check 2017-04-20 05:05:19.6524,Debug,Software compatible 2017-04-20 05:05:19.6524,Info,Start retrieving initial data 2017-04-20 05:05:20.0344,Info,initial data retrieved 2017-04-20 05:05:20.2044,Trace,Received notification SystemTimeUpdateNotification 2017-04-20 05:05:21.2144,Trace,Received notification SystemTimeUpdateNotification
登录服务器端:
2017-04-20 05:03:31.6069;Trace;KeepAlive(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:03:41.6225;Trace;KeepAlive(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:03:51.6371;Trace;KeepAlive(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:04:01.6527;Trace;KeepAlive(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:05:14.5661;Info;Abort(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:05:14.5661;Info;Removing connection 6a12952a-1cb4-4933-b6b1-db16158958a9 2017-04-20 05:05:14.5661;Info;End(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:05:14.5841;Trace;DrainWrites(6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:05:14.5841;Info;CompleteRequest (6a12952a-1cb4-4933-b6b1-db16158958a9) 2017-04-20 05:05:19.6344;Info;Connection 9249a8a5-8653-450c-b8da-c5b7a4c7df81 is New. 2017-04-20 05:05:27.6738;Trace;KeepAlive(9249a8a5-8653-450c-b8da-c5b7a4c7df81) 2017-04-20 05:05:37.6874;Trace;KeepAlive(9249a8a5-8653-450c-b8da-c5b7a4c7df81)
现在我到了很奇怪的一部分。 “有一段时间”实际上是相当固定的。我抬头一看日志条目的最后几天,它似乎总是绕每11小时
Inactivity Timestamp Difference with previous LogEntry 17/04/2017 17:59:44 0:00:00 The client has been inactive since 4/17/2017 3:58:35 PM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 17/04/2017 17:59:44 11:01:06 The client has been inactive since 4/17/2017 3:58:35 PM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 17/04/2017 06:58:38 10:01:01 The client has been inactive since 4/17/2017 4:57:34 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 16/04/2017 20:57:37 11:01:06 The client has been inactive since 4/16/2017 6:56:29 PM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 16/04/2017 09:56:31 11:01:06 The client has been inactive since 4/16/2017 7:55:23 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 15/04/2017 22:55:25 11:01:06 The client has been inactive since 4/15/2017 8:54:17 PM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 15/04/2017 11:54:19 0:00:00 The client has been inactive since 4/15/2017 9:53:09 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 15/04/2017 11:54:19 11:01:07 The client has been inactive since 4/15/2017 9:53:09 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 15/04/2017 00:53:12 11:01:06 The client has been inactive since 4/14/2017 10:52:03 PM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 14/04/2017 13:52:06 11:01:06 The client has been inactive since 4/14/2017 11:50:58 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection. 14/04/2017 02:51:00 The client has been inactive since 4/14/2017 12:49:52 AM and it has exceeded the inactivity timeout of 00:00:50. Stopping the connection.
有什么样的最大连接时间或者这可能是造成这种现象?
编辑1: 如果我在Windows 8上运行相同的代码,我没有这个问题。 我猜它是与运输方法在Windows 7上使用(不支持WebSockets的)
编辑2:
Server Client Inactivity problem Win 8 Win 8 No Win 7 Win 7 Yes Win 7 Win 8 No Win 8 Win 7 Yes
如此看来相关的操作系统客户。
听起来就像是IIS回收时间...... – thab
这不可能是问题,因为我不使用IIS – Joris