Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 25, 2013 07:16 PM by davidfowl
Jan 23, 2013 08:18 AM|LINK
I have a .NET WinService. It successfully opens a connection to a Hub. The problem I have is that every 2 seconds connection_StateChanged is fired and is reconnecting all the time. I dont receive any errors and I dont know why it behaves this way. Is there
any way to troubleshoot disconnections and reconnections?
Jan 23, 2013 10:49 AM|LINK
Try using fiddler. Also what transport is being used? You can turn logging on the server side and collect a trace. See how to do that here:
Jan 23, 2013 11:05 AM|LINK
Try using fiddler. Also what transport is being used?
Maybe that's the issue. Is the .NET Client code by default using Long Polling. Is there any way to enforce it to use WebSockets?
Jan 23, 2013 11:53 AM|LINK
Yes that was the issue. I forced it to use ServerSentEvents. Heres how I did it for anyone experiencing the same issue
HubConnection connection = new HubConnection("http://www.mysite.com");
Jan 23, 2013 03:58 PM|LINK
That's not a solution to anything but to force server sent events. Do you know why it was falling back to longpolling? Did you install fiddler? Do you look at the trace? It should only fallback if it times out trying to connect in the first place. When you
say it was reconnecting every 2 seconds did you mean 2 minutes? If so that's by design as longpolling connections timeout and reconnect after 2 minutes to avoid being forcibly closed by load balancers and network proxies that hate idle traffic.
Jan 24, 2013 06:18 AM|LINK
When I say 2 seconds I mean 2 seconds not two minutes. And I dont understand why using long polling for a .NET web service instead of server events is a bad idea.
Jan 24, 2013 06:23 AM|LINK
It is not a bad idea thats' the point. That's why I wanted you to use fiddler to see why the request was ending. It shouldn't happen and I'm interested to know what causes the issue.
Jan 24, 2013 06:27 AM|LINK
I cannot capture any traffic using Fiddler from my windows service. I have the trace log file if you want but I can only send it to you in private.
Jan 25, 2013 07:16 PM|LINK