SignalR won't use Websocket protocol even thou

2019-02-22 20:00发布

I'm using signalr to do some real-time events in my web application. I'm trying to force signalr to use the new websocket protocol but it won't, even if I specify it.

$.connection.hub.start({ transport: 'webSockets' })

I definitely have the web socket protocol installed and I am running Windows 8 with IIS 8.

What else do I need to do to enable web sockets support in signalr?

3条回答
走好不送
2楼-- · 2019-02-22 20:36

Ensure that your app is using the .NET 4.5 assembly from the SignalR package. If the project is targeting 4.0, or it started that way, then nuget would have added a reference to the 4.0 SignalR assembly which doesn't support websockets. If that's the case, then just uninstall and re-install the signalr packages into your project.

查看更多
狗以群分
3楼-- · 2019-02-22 20:45

Web Sockets requires .NET 4.5.

If you try running it on Windows Server 8 in the future be sure to activate the Web Sockets feature.

查看更多
【Aperson】
4楼-- · 2019-02-22 20:49

If you are already using framework 4.5 but still no luck, add an HTTPS binding to your IIS website and access the website over HTTPS.

查看更多
登录 后发表回答