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:
Adding <appSettings><add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
~No change Local works / server did not
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 )
Tried uppgrading to Signalr 2.2.2 form 2.2.1 ~No change Local works / server did not
Server restarts ~No change Local works / server did not
Testing change to <httpRuntime targetFramework="4.6.2"...
~No change Local works / server did not
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
原来是在applicationhost.config中缺少一行,需要更新以包括:
<add name="WebSocketModule" lockItem="true" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.