2017-02-09 71 views
0

任务取消等待Groups.Add(groupId,Context.ConnectionId);在Win8上仍然存在WebSockets。 如果此请求超过30秒,我如何增加信号超时。任务取消等待Groups.Add(groupId,Context.ConnectionId);

任务是canceled.mscorlibStackTrace:--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务task)

请帮助我出去了。

+1

你不会增加这个超时。我会搜索你有这个超时的原因。 – Tester

回答

0

也许你不应该增加超时时间。请看这question,因为它解释了你可以观察到的行为。适当的行动是检查客户端提到的问题并相应处理,而不会增加超时时间。

但正如你所问,这里是你如何做到这一点。将其添加到启动类中。

// Make long polling connections wait a maximum of 110 seconds for a 
// response. When that time expires, trigger a timeout command and 
// make the client reconnect. 
GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(110); 

// Wait a maximum of 30 seconds after a transport connection is lost 
// before raising the Disconnected event to terminate the SignalR connection. 
GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(30); 

// For transports other than long polling, send a keepalive packet every 
// 10 seconds. 
// This value must be no more than 1/3 of the DisconnectTimeout value. 
GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(10); 

您需要增加DisconnectTimeout。有一点要记住:设置顺序KeepAliveDisconnectTimeout是重要的。如果您在设置KeepAlive后设置DisconnectTimeout,则会覆盖KeepAlive的值。

+0

在我的情况下,我只有一个中心,我握手并进行组呼。 有没有什么办法可以让SR向我们提供服务器端连接客户端的列表,我可以跟踪客户端的状态。 正如我在研发之后发现的,我们必须制作自定义列表,它可以反复更新SR的连接和断开事件。 还有同样的问题如何摆脱这一点。请帮助我。 –

+0

不,没有办法获得连接用户列表 - 这是真的。您必须重写集线器的OnConnected和OnDisconnected方法,并自行构建您的已连接用户列表。 – cassandrad