Asp.net core AspNet核心信号器保持生存超时的一些问题
在我们的项目中,我将信号机设置如下:Asp.net core AspNet核心信号器保持生存超时的一些问题,asp.net-core,asp.net-core-signalr,Asp.net Core,Asp.net Core Signalr,在我们的项目中,我将信号机设置如下: services.AddSignalR() .AddHubOptions<NotificationHub>(options => { const int keepAliveIntervalInSeconds=60; options.EnableDetailedErrors=true; options
services.AddSignalR()
.AddHubOptions<NotificationHub>(options =>
{
const int keepAliveIntervalInSeconds=60;
options.EnableDetailedErrors=true;
options.ClientTimeoutInterval = TimeSpan.FromSeconds(2 * keepAliveIntervalInSeconds);
options.HandshakeTimeout = TimeSpan.FromSeconds(keepAliveIntervalInSeconds);
options.KeepAliveInterval = TimeSpan.FromSeconds(keepAliveIntervalInSeconds);
});
这里有什么我做错的吗
错误:连接已断开,错误为“错误:服务器超时,但未收到服务器的消息。”
在中,我们可以发现:
KeepAliveInterval
的默认值为15秒。更改KeepAliveInterval
时,我们还需要更改客户端的ServerTimeout/servertimeoutinmillizes
设置。并且建议的ServerTimeout/servertimeoutinmillizes
值是KeepAliveInterval
值的两倍
默认超时值为30000毫秒(30秒),如果您只需将信号器集线器的
KeepAliveInterval
设置更新为60秒,但不更改客户端的servertimeoutingmillizes
值,则会导致上述错误。@sommen这是60秒。你的意思是握手超时也应该大于间隔吗?我错了,我看错了。我不确定-我没有接触过这些设置,它们似乎适合我做的任何事情。对不起,原来客户端的设置足以满足我的要求。
[2020-06-03T09:48:44.367Z] Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message from the server.'.