signalr failed to connect to LongPolling or serverSentEvents transport when using sqlserver scaleout RRS feed

  • Question

  • User780447275 posted

    When i am using sqlserver scaleout with signalr GlobalHost.DependencyResolver.UseSqlServer, it failed to connect to LongPolling or serverSentEvents transport.

    Anyone faced this error before, i am using signalr 2.2.1 and signalr.sqlserver 2.2.1.

    here is my full code in owin startup class

    string sqlConnectionString = "Server=NCBCDEV;Database=SignalR2;Integrated Security=true"; SqlScaleoutConfiguration sqlcon = new SqlScaleoutConfiguration(sqlConnectionString); GlobalHost.DependencyResolver.UseSqlServer(sqlcon ); app.MapSignalR(); GlobalHost.DependencyResolver.Register(typeof(Microsoft.AspN‌​et.SignalR.Hubs.IAss‌​emblyLocator), () => new AssemblyLocator());

    and the log trace is:

    13:59:38.277 :82/signalr/hubs/connect?transport=serverSentEvents&clientProtocol=1.5&conn…48Kldg%3D%3D&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&tid=0:1 GET http://ncbcdev:82/signalr/hubs/connect?transport=serverSentEvents&clientPro…zC48Kldg%3D%3D&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&tid=0 net::ERR_CONNECTION_RESET
    SignalR: serverSentEvents transport failed to connect. Attempting to fall back.
    longPolling transport starting.
    SignalR: longPolling transport failed to connect. Attempting to fall back.
    13:59:52.655 jquery.signalR-2.2.1.min.js:9 [13:59:52 GMT+0300 (Arab Standard Time)] SignalR: Fallback transports exhausted.

    Monday, July 3, 2017 11:34 AM

All replies

  • User61956409 posted

    Hi mohamedhamed,


    it failed to connect to LongPolling or serverSentEvents transport.

    As far as I know, each transport option has a set of requirements of its own, if the system requirements for a transport are not available, SignalR will gracefully failover to other transports.

    The following list shows the steps that SignalR uses to decide which transport to use. For detailed information, please check "Transport selection process" section in this article.

    1. If the browser is Internet Explorer 8 or earlier, Long Polling is used.
    2. If JSONP is configured (that is, the jsonp parameter is set to true when the connection is started), Long Polling is used.
    3. If a cross-domain connection is being made (that is, if the SignalR endpoint is not in the same domain as the hosting page), then WebSocket will be used if the following criteria are met:

      • The client supports CORS (Cross-Origin Resource Sharing). For details on which clients support CORS, see CORS at caniuse.com.
      • The client supports WebSocket
      • The server supports WebSocket

        If any of these criteria are not met, Long Polling will be used. For more information on cross-domain connections, see How to establish a cross-domain connection.

    4. If JSONP is not configured and the connection is not cross-domain, WebSocket will be used if both the client and server support it.
    5. If either the client or server do not support WebSocket, Server Sent Events is used if it is available.
    6. If Server Sent Events is not available, Forever Frame is attempted.
    7. If Forever Frame fails, Long Polling is used.
    Tuesday, July 25, 2017 8:45 AM