Signalr WebSockets not working on Windows server 2012 R2 + IIS 8.5 with enabled websocket protocol, But works on local development machine (Win 10)

浪子不回头ぞ 提交于 2019-12-25 11:52:39

问题


Signalr WebSockets not working on Windows server 2012 R2 + IIS 8.5 with enabled websocket protocol, But works on local development machine (Win 10).

Both set-up as per: https://www.iis.net/configreference/system.webserver/websocket

Server (Websockets not working) -Windows 2012 R2 Standard -IIS 8.5 -Websockets enabled -Client Chrome version 58 64bit (Running locally on server just like dev machine - to eliminate load balancer, or network issue) Signal returns TryWebSockets:false (SSE, longpolling and Forever Frame do work)

Local Development Machine (WebSockets are working) -Windows 10 -IIS 10.0.10586.0 -Client Chrome version 58 64bit Signal returns TryWebSockets:true

Web.config has:

<system.web>
        <httpRuntime targetFramework="4.5"...

and

<compilation defaultLanguage="c#" debug="true" targetFramework="4.6.2">

Grasping at straws:

  1. Adding <appSettings><add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/> ~No change Local works / server did not

  2. re-install the signalr packages ~No change Local works / server did not (referenced Form: SignalR won't use Websocket protocol even though I have the protocol installed in windows 8)

  3. Tried uppgrading to Signalr 2.2.2 form 2.2.1 ~No change Local works / server did not

  4. Server restarts ~No change Local works / server did not

  5. Testing change to <httpRuntime targetFramework="4.6.2"... ~No change Local works / server did not

  6. Client side explicitly set to use websockets

    $.connection.hub.start({ transport: 'webSockets' }, function () { console.log('connection started WebSockets!'); }).done(function ()

~No change Local works / server did not

Checked Assemblies https://forums.asp.net/p/1872743/5263876.aspx


回答1:


Turned out to be missing a line in the applicationhost.config, needed to be updated to include:

<add name="WebSocketModule" lockItem="true" />



来源:https://stackoverflow.com/questions/43878470/signalr-websockets-not-working-on-windows-server-2012-r2-iis-8-5-with-enabled

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