SignalR 2.2.0 WebSocket连接到集线器时出错 [英] SignalR 2.2.0 WebSocket error connecting to hub

查看:438
本文介绍了SignalR 2.2.0 WebSocket连接到集线器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个向其中添加SignalR的ASP.Net MVC应用程序.遵循"入门"之后教程(由于会在我的应用程序中进行,因此需要进行一些修改),我可以在localhost上运行它.但是,一旦进入生产环境,就会出现以下错误:

I have an ASP.Net MVC application that I have added SignalR to. After following the "Getting Started" tutorial (with modifications of course since it's going in my application) I got it working on localhost. However once it's in the production environment, I get the following error:

与'ws://xxxxx/signalr/connect?transport = webSockets& clientProtocol = 1.5& connectionToken = xxxxx'的WebSocket连接失败:连接在收到握手响应之前已关闭.

WebSocket connection to 'ws://xxxxx/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=xxxxx' failed: Connection closed before receiving a handshake response.

我可以访问/signalr/hubs(我得到一个js文件).关于为什么会发生这种情况有什么想法吗?

I can access /signalr/hubs (I get a js file). Any ideas as to why this would happen?

推荐答案

这可能是由于您的Web服务器不支持WebSockets(例如IIS 7.5).也可能是由于您正在使用ARR之类的代理"服务器,它只是无法路由" WebSocket请求.

This may be due to the fact that your web server doesn't support WebSockets (IIS 7.5, for instance. It may also be due to the fact that you are using a "proxy" server like ARR and it just cannot "route" WebSocket requests.

我想做的第一件事就是禁用SignalR上的WebSocket,就像调试工具一样.方法如下: SignalR-如何禁用WebSockets

The first thing I would try to do is to disable WebSockets on SignalR, just as a debug tool. Here's how: SignalR - How do I disable WebSockets

如果问题仍然存在,则是一般的SignalR问题,但至少会有一个更具体的错误.如果问题停止了,现在您知道这是服务器问题.

If your problem persists, it's a general SignalR problem but at least you will have a more specific error. If the problem stops, now you know it is a server issue.

这篇关于SignalR 2.2.0 WebSocket连接到集线器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆