首页 文章

任务在await Groups.Add(groupId,Context.ConnectionId)上取消了问题;

提问于
浏览
0

任务在await Groups.Add(groupId,Context.ConnectionId)上取消了问题;仍然存在Win8上的WebSockets . 如果此请求超过30秒,如何增加信号器超时 .

任务被取消.mscorlibStackTrace:--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

请帮帮我 .

1 回答

  • 0

    可能,你不应该增加超时 . 请查看此question,因为它解释了您可以观察到的行为 . 适当的操作是在客户端检查提到的问题并相应地处理它,而不是增加超时时间 .

    但正如你所问,这就是你如何做到的 . 在Startup类中添加它 .

    // 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 值 .

相关问题