简体   繁体   English

SignalR websockets 在端口 80 上不起作用

[英]SignalR websockets not working on port 80

I am having an issue with all browsers not making a websocket connection over port 80 to my IIS 10 webserver.我遇到了一个问题,所有浏览器都没有通过端口 80 与我的 IIS 10 网络服务器建立 websocket 连接。 If I RDP into the server and browse to the application or if I use ssl (443) it works just fine.如果我 RDP 进入服务器并浏览到应用程序,或者如果我使用 ssl (443) 它工作得很好。 It does successfully fallback to longpolling but I would like to strictly use websockets.它确实成功回退到长轮询,但我想严格使用 websockets。

I am running an asp.net mvc 5 app using the 4.6 framework.我正在使用 4.6 框架运行 asp.net mvc 5 应用程序。 Websockets are enabled on the server.服务器上启用了 Websocket。 Has anyone else ran into this issue or have any suggestions to resolve it?有没有其他人遇到过这个问题或有任何解决它的建议?

EDGE error: jquery.signalR-2.4.3.js:1893 WebSocket connection to 'ws://' failed: Connection closed before receiving a handshake response EDGE 错误:jquery.signalR-2.4.3.js:1893 WebSocket 连接到“ws://”失败:连接在收到握手响应之前关闭

Firefox, Chrome error: jquery.signalR-2.4.3.js:1893 WebSocket connection to 'ws://' failed: Firefox,Chrome 错误:jquery.signalR-2.4.3.js:1893 WebSocket 连接到 'ws://' 失败

progress = $.connection.manifestHub;
console.log(progress);

progress.client.ShowProgress = function (message) {
  $('#ProgressMessage').width(message);
};

$.connection.hub.logging = true;
$.connection.hub.start({ transport: 'webSockets' }).done(function () {
      connectionId = $.connection.hub.id;
      $("#connectionId").val(connectionId);
      console.log(connectionId);
});
 var hubConfig = new HubConfiguration();
 hubConfig.EnableDetailedErrors = true;
            
 app.MapSignalR(hubConfig);

Your web server probably doesn't support WebSockets, probably because you're using a "proxy" server like ARR that just can't "route" WebSocket requests.您的 web 服务器可能不支持 WebSockets,可能是因为您使用的是像 ARR 这样的“代理”服务器,它无法“路由”WebSocket 请求。 Try disabling WebSockets on SignalR, if the issue persists it's a general SignalR issue, but at least you'll get a more specific error.尝试在 SignalR 上禁用 WebSockets,如果问题仍然存在,这是一般的 SignalR 问题,但至少您会收到更具体的错误。 If the problem stops, now you know it's a server problem.如果问题停止,现在您知道这是服务器问题。

Have you seen this thread ?你见过这个线程吗? This is an answer provided by @Andre Pena.这是@Andre Pena 提供的答案。 I tried and this helped me.我试过了,这对我有帮助。 I think this might help you.我想这可能会对你有所帮助。

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

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