SignalR - always drops to servers sent to Chrome / Firefox

I have an API application and a web application (for simplicity on the same server - I will do CORS stuff later).

  • Windows Server 2012 with IIS 8.5
  • Web Sites Installed Through Programs and Features
  • Firewall is off

Api uses owin + signalr and has the correct initialization (truncates it to find the error):

public void Configuration(IAppBuilder app) { GlobalHost.Configuration.TransportConnectTimeout = TimeSpan.FromSeconds(5); app.MapSignalR(); app.UseWebApi(Startup.CreateConfiguration()); } private static HttpConfiguration CreateConfiguration() { HttpConfiguration configuration = new HttpConfiguration(); configuration.MapHttpAttributeRoutes(); return configuration; } 

Everything seems to work just fine, except for connecting to actual websites. Each time the client tries to establish a connection, a timeout occurs and it switches to SSE (or forever frame / long polling in IE). I increased the timeout to 25 seconds, and the same symptoms appear.

On the client, I sequentially get this error with the protocol enabled:

 SignalR: Connecting to websocket endpoint 'ws://[myurl]'. SignalR: Websocket opened. SignalR: **webSockets timed out when trying to connect.** SignalR: Closing the Websocket. SignalR: Attempting to connect to SSE endpoint 'http://[myurl]'. SignalR: EventSource connected. SignalR: serverSentEvents transport selected. Initiating start request. SignalR: The start request succeeded. Transitioning to the connected state. 

I tried following the instructions provided by the signalR command, and I don't see what is missing.

Thanks for any help!

UPDATE: I downloaded the sample and ran it as is on the server. In the same situation, so this is probably the server configuration setting that I skipped along the way. I still haven't found what I missed.

+5
source share
4 answers

You need to enable WebSockets for the website in Server Manager.

http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

+1
source

It could be something with your IIS settings. I saw them at http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/supported-platforms

-IIS should work in integrated mode; Classic mode is not supported. Message delays for 30 seconds can occur if IIS starts in classic mode using an event transport with the server.

-The hosting object should work in full trust mode.

In addition, he mentioned that .NET 4.5 is the target environment. Hope this helps.

0
source

Try to establish a SignalR connection from the Windows Server machine itself. This may have something to do with the network. Perhaps there is a proxy or something between a client and a server that does not support WebSockets.

0
source

If you are on a network with a "corporate" firewall, this can ruin the handshake of web cards.

But you can prevent this interference when accessing the server via SSL. I saw how this first hand was the reason and the solution several times for problems with webcams in corporate environments.

0
source

Source: https://habr.com/ru/post/1201257/


All Articles