client constantly reconnecting

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-29 06:29:10

问题


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?


回答1:


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.




回答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!



来源:https://stackoverflow.com/questions/15003655/client-constantly-reconnecting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!