简体   繁体   English

SignalR等待启动连接

[英]SignalR pending start connection

I'm implementing the SignalR library to use websocket in a kind of 'queue', in a ASP.NET MVC Application. 我正在实现SignalR库,以便在ASP.NET MVC应用程序中以一种“队列”的形式使用websocket。

Everything works as expected when there are only two users. 只有两个用户时,一切正常。 When a third one logs in (I mean, I open a new tab), his SignalR start request is pending, and other users can not use application anymore. 当第三个用户登录(我是说,我打开一个新选项卡)时,他的SignalR启动请求正在等待处理,其他用户无法再使用该应用程序。

It's happening with all browsers: if I open 3 Chrome tabs, or 3 Firefox, or 2 Chrome or 1 Firefox, or 2 Firefox and 1 Chrome.. it's pending forever. 所有浏览器都在发生这种情况:如果我打开3个Chrome选项卡,或3个Firefox,或2个Chrome或1个Firefox,或2个Firefox和1个Chrome,..它将永远挂起。

在此处输入图片说明

My code is the same as the one provided for SignalR tutorials: "Getting Started with SignalR 2 and MVC 5". 我的代码与为SignalR教程提供的代码相同:“ SignalR 2和MVC 5入门”。

Could anyone solve this? 谁能解决这个问题? I'm starting to think that is an IIS limitation, but I'm not 100% sure. 我开始认为这是IIS的局限性,但我不确定100%。 I'm using the last SignalR version (2.3.0), 4.6.1 ASP version (I already enabled WebSockets in the IIS configuration). 我正在使用最新的SignalR版本(2.3.0),4.6.1 ASP版本(我已经在IIS配置中启用了WebSockets)。

I've found a similar question ( SignalR start pending ) but it doesn't seem to give an answer. 我发现了一个类似的问题( SignalR开始未决 ),但似乎没有给出答案。

JavaScript (client) code: JavaScript(客户端)代码:

 var attendHub = $.connection.attendHub;

    // Create a function that the hub can call back
    attendHub.client.reloadGrid = function (sr) {
        // Business logic
        }
    };

    $.connection.hub.start();

Server Hub (C#) code: 服务器中心(C#)代码:

public class AttendHub : Hub
{
    private static readonly IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext<AttendHub>();

    public static void RefreshAttendList(int branchId)
    {
        // Business logic
        ///...
        hubContext.Clients.All.ReloadGrid(sr);
    }
}

And I'm calling the RefreshAttendList method from a controller, executing this line: 我从控制器调用RefreshAttendList方法,执行以下行:

AttendHub.RefreshAttendList(AppInfo.ActiveUser.BranchId);

What could I be doing wrong? 我可能做错了什么?

Well, I figured out that it was a Local IIS limitation, because I changed the configuration to use IIS Express instead of Local, and it's working like a charm! 好吧,我发现这是本地IIS的局限性,因为我将配置更改为使用IIS Express而不是本地,并且运行起来很吸引人!

Hope this helps to anyone with the same issue! 希望这对遇到同样问题的人有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM