5

My .net application which connects to signalr hub is constantly reconnecting.

This problem only occurs on certain other corporate networks which makes me believe something is being blocked. I've tried to use the jabbr.net website from the same network and this doesn't work either (in chrome).

How can i trace/fix this issue?

enter image description here

2 Answers2

3

I think you're experiencing this issue https://github.com/SignalR/SignalR/pull/1553. We're working on a fix for it. The issue happens when the server sent events request times out but the actual http requests is still going. What then happens is that the longpolling transport and server sent events http requests fight for the connection.

To workaround this you can specify the LongPollingTransport specifically. We'll look at fixing this for the next release.

davidfowl
  • 37,120
  • 7
  • 93
  • 103
  • 2
    The bug is fixed and will be in the next release https://github.com/SignalR/SignalR/commit/0a6ff146d482470297e92ccc3e7702ee0ae1eede – davidfowl Feb 22 '13 at 11:37
  • I have this same issue with the .NET signalr client version 2.2.1.0 under .NET 4.0. I start the client by setting SSE as the protocol. When what @davidfowl describes happens, the client goes through the endless sequence of connect, dispose, stop and immediately reconnect, dispose, stop. I don't see the client switching between LongPollingTransport and SSE - just stays with SSE. After starting the client, I attach a ContinueWith to detect exceptions/Task fault. IIRC, removing the ContinueWith helped at one point but I like to keep it and don't want to handle exceptions around Task.wait(). – Stack Undefined Nov 20 '16 at 19:58
  • If you specify a transport it doesn't fallback. – davidfowl Nov 21 '16 at 09:10
  • It's weird how I get this problem only when I **DO** specify a `ClientTransport` (either `ServerSentEventsTransport` or `LongPollingTransport`) before starting the `HubConnection`. What could be the reason for this? – Nii Laryea Jan 23 '18 at 16:36
2

For your server, in your web.config's system.diagnostics section add:

<sharedListeners>
  <add name="SignalR" 
       type="System.Diagnostics.TextWriterTraceListener" 
       initializeData="signalr.log.txt" />
</sharedListeners>

For your client (I'm assuming .net C#), its logging is via Debug.Writes. Also, I'd recommend hooking into the Error handler for your connection.

If your using a JS client you can turn logging on via

// Non dynamically made connection
connection.logging = true;
// Dynamically made connection
$.connection.hub.logging = true

Hope this helps!

N. Taylor Mullen
  • 18,061
  • 6
  • 49
  • 72