SignalR connection won't start to IIS-hosted app

别来无恙 提交于 2020-05-09 10:30:06

问题


I made an application, and am trying to connect to the backend via SignalR.

The ASP.NET Core 3.1 backend is hosted in IIS for easy development.

Calling the StartAsync method on the client successfully negotiates, but then hangs forever on the GET:

GET http://localhost:81/signalr?id=W3F2TRVrx_lxZoinHzTzmA

The StartAsync() call can't return.

This only happens on IIS. When I start the app self-hosted, it works.

The rest of the WebAPI works on the IIS as well. Just SignalR won't connect.

Any idea why? I found quite a few questions and answers here, but none of them actually solve this precise problem.


回答1:


So I actually found the answer myself:

Websocket support is not enabled by default on IIS. It was introduced in IIS 8, and has to be enabled from windows' optional features: https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

Optional features -> IIS -> WWW services -> App Dev Features -> Websocket protocol



来源:https://stackoverflow.com/questions/61371964/signalr-connection-wont-start-to-iis-hosted-app

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