小编Cas*_*per的帖子

.NET Core SignalR,服务器超时/重新连接问题

我有一个用我的MVC解决方案编写的SignalR集线器,并且有一个Javascript客户端从视图连接。

连接的重点是从服务器接收墙板的更改。由于网页是在没有直接访问PC的屏幕上运行的,因此这几乎必须立即发生并且需要终身连接。

到目前为止,SignalR连接工作了几个小时才给出错误。

我得到的错误是

Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message form the server.'.
Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
Warning: Error from HTTP request. 0:
Error: Failed to complete negotiation with the server: Error
Error: Failed to start the connection: Error

Uncaught (in promise) Error
    at new HttpError (singlar.js:1436)
    at XMLHttpRequest.xhr.onerror (singalr.js:1583)
Run Code Online (Sandbox Code Playgroud)

我的客户代码

 let connection = new signalR.HubConnectionBuilder()
    .withUrl("/wbHub")
    .configureLogging(signalR.LogLevel.Information)
    .build();

connection.start().then(function () {
    connection.invoke("GetAllWallboards").then(function (wallboard) {
        for (var i = 0; i < …
Run Code Online (Sandbox Code Playgroud)

signalr asp.net-core-mvc .net-core

4
推荐指数
2
解决办法
4339
查看次数

标签 统计

.net-core ×1

asp.net-core-mvc ×1

signalr ×1