SignalR 2.2.0 WebSocket error connecting to hub

霸气de小男生 提交于 2019-12-08 02:14:47

问题


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:

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

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


回答1:


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.

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

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.



来源:https://stackoverflow.com/questions/31011288/signalr-2-2-0-websocket-error-connecting-to-hub

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!