client constantly reconnecting

2020-02-10 08:57发布

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条回答
家丑人穷心不美
2楼-- · 2020-02-10 09:00

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!

查看更多
狗以群分
3楼-- · 2020-02-10 09:12

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.

查看更多
登录 后发表回答