SignalR Core和ASP.NET Core 2.x:每5秒协商获取404

时间:2018-09-20 13:34:20

标签: asp.net-core asp.net-core-signalr

我正在使用SignalR Core和ASP.NET Core2.x。

客户端版本:1.0.3 伺服器版本:1.0.3.18207 在Azure应用服务上运行。

每个登录用户每5秒就会收到404错误,这是错误:

/signalr/negotiate?clientProtocol=1.5&connectionToken = ...

我无法在开发环境中重现此错误,仅当将其部署到Azure App Service时才会发生。在我的开发环境中,我还尝试了捆绑软件(将环境设置为“生产”),但问题没有发生。

需要指出的一点是:通知在DEV和PROD环境中均有效。我看不到任何功能性问题,只是这个错误,当更多用户登录时,该错误使系统崩溃。仅观察一下,即使只有一个用户登录也可以看到该错误。

编辑:此错误每5秒钟发生一次。我没有更改任何默认配置,例如KeepAlive。

enter image description here

StartUp.ConfigureServices:

            // SignalR
            services
                .AddSignalR()
                .AddJsonProtocol(options =>
                {
                    options.PayloadSerializerSettings.ContractResolver = new DefaultContractResolver();
                });

StartUp.Configure:

            app.UseSignalR(routes =>
            {
                routes.MapHub<MessageHub>("/MessageHub");
            });

消息运行正常,但是如上所述,我仍然每5秒收到400错误。

Azure App Service应用程序设置:

enter image description here

1 个答案:

答案 0 :(得分:0)

您是否正在使用Chrome,并且已禁用第三方Cookie?

Disabled cokies