I have a WPF-Application that runs as the SignalR server and several mobile devices which are using an android application that I built with xamarin studio.
This android application contains my SignalR client.
I've been running this configuration for over a year now and everything worked fine.
But in the last time I get problems connecting from my client to the server.
After I have started my Android application I try to connect to the server and this first connection attempt runs into a timeout almost everytime. If this first attempt has fail, I do a second connection attempt and it immediately connects.
I have not done any changes on my server or my client code. The only thing that I changed was going from Xamarin Studio to Visual Studio 2015, which now includes Xamarin Development Tools.
This is basically my client code:
public IHubProxy HubProxy1 { get; set; }
public HubConnection Connection1 { get; set; }
Please let me know if you need further information!!!
Edit: Here is the error log:
System.TimeoutException: Transport timed out trying to connect
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at CEN40.MainActivity+<Connect1Async>d__105.MoveNext () [0x00504] in D:\_GitArbeitskopien\Cordenka\src\App\CEN40\CEN40\MainActivity.cs:2127
For me it seems like there's something going wrong in the latest version of the Xamarin.Android SDK. As I said, the only thing I did was using Visual Studio instead of Xamarin Studio, my code for connecting to the SignalR server has not been changed. So
when I started using Visual Studio, I was updating Xamarin.Android to the latest version. Since then, the SignalR connection did not work correctly anymore. So my current solution was to downgrade to an earlier version of Xamarin.Android and at the moment
SignalR connects fine again.
None
0 Points
2 Posts
SignalR client does not connect at first attempt
Sep 01, 2016 09:39 AM|NWeis|LINK
Hello,
I have the following problem:
I have a WPF-Application that runs as the SignalR server and several mobile devices which are using an android application that I built with xamarin studio.
This android application contains my SignalR client.
I've been running this configuration for over a year now and everything worked fine.
But in the last time I get problems connecting from my client to the server.
After I have started my Android application I try to connect to the server and this first connection attempt runs into a timeout almost everytime. If this first attempt has fail, I do a second connection attempt and it immediately connects.
I have not done any changes on my server or my client code. The only thing that I changed was going from Xamarin Studio to Visual Studio 2015, which now includes Xamarin Development Tools.
This is basically my client code:
And this is what my server code looks like:
then I have a startupClass:
and my hub:
Please let me know if you need further information!!!
Edit: Here is the error log:
All-Star
18815 Points
3831 Posts
Re: SignalR client does not connect at first attempt
Sep 12, 2016 05:25 AM|Nan Yu|LINK
Hi NWeis,
That is quite strange . You'd better try to troubleshooting the application ,and confirm whether somewhere block the first connection :
http://www.asp.net/signalr/overview/testing-and-debugging/troubleshooting
Best Regards,
Nan Yu
None
0 Points
2 Posts
Re: SignalR client does not connect at first attempt
Sep 12, 2016 06:40 AM|NWeis|LINK
Hello Nan Yu,
thanks for your reply.
For me it seems like there's something going wrong in the latest version of the Xamarin.Android SDK. As I said, the only thing I did was using Visual Studio instead of Xamarin Studio, my code for connecting to the SignalR server has not been changed. So when I started using Visual Studio, I was updating Xamarin.Android to the latest version. Since then, the SignalR connection did not work correctly anymore. So my current solution was to downgrade to an earlier version of Xamarin.Android and at the moment SignalR connects fine again.