SignalR - Release Build: Server Negotiate Error

An annoying error is encountered in my Xamarin app. The solution contains an Android project and a portable class library. Inside a Portable Class Library, I have a class that communicates with the SignalR Hub using the methodInitiateConnection

HubConnection conn= new HubConnection(_url);

// Some events will be registrated on the HubConnection here...

if (!string.IsNullOrWhiteSpace(_userName))
{
    conn.Credentials = new System.Net.NetworkCredential(_userName, _password);
}
await conn.Start();

      

Once I use the method above in a debug build, it works correctly and I get the data. If this method is called in a release build, it will throw an exception. First, an unhandled exception from Xamarin. After clicking continues, I get the following exception:

System.InvalidOperationException: Server negotiation failed.


Unhandled Exception:
System.InvalidOperationException: Server negotiation failed.
at Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.<GetNegotiationResponse>b__1 (System.String raw) [0x00000] in <filename unknown>:0 
at Microsoft.AspNet.SignalR.TaskAsyncHelper+<>c__DisplayClass19`2[System.String,Microsoft.AspNet.SignalR.Client.NegotiationResponse].<Then>b__17 (System.Threading.Tasks.Task`1 t) [0x00000] in <filename unknown>:0 
at Microsoft.AspNet.SignalR.TaskAsyncHelper+TaskRunners`2+<>c__DisplayClass3a[System.String,Microsoft.AspNet.SignalR.Client.NegotiationResponse].<RunTask>b__39 (System.Threading.Tasks.Task`1 t) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0 
at Monitoring.Client.MonitorProxy+<InitiateConnection>d__0.MoveNe
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Server negotiation failed.
at Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.<GetNegotiationResponse>b__1 (System.String raw) [0x00000] in <filename unknown>:0 
 at Microsoft.AspNet.SignalR.TaskAsyncHelper+<>c__DisplayClass19`2[System.String,Microsoft.AspNet.SignalR.Client.NegotiationResponse].<Then>b__17 (System.Threading.Tasks.Task`1 t) [0x00000] in <filename unknown>:0 
at Microsoft.AspNet.SignalR.TaskAsyncHelper+TaskRunners`2+<>c__DisplayClass3a[System.String,Microsoft.AspNet.SignalR.Client.NegotiationResponse].<RunTask>b__39 (System.Threading.Tasks.Task`1 t) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0 
at Monitoring.Client.MonitorProxy+<InitiateConnectio`

      

An exception was thrown on the last line of the method: await conn.Start();

If I read the Exception property for the Task, I see the same error as above. The issue occurs with both the NuGet package and the recently released Xamarin. Does anyone know what the problem is?

+3
c # portable-class-library xamarin signalr signalr.client


source to share


No one has answered this question yet

Check out similar questions:

73
Best Practice for Reconnecting SignalR 2.0.NET Client to Server
ten
SignalR "Error during negotiation request"
4
monogame content load file no exception found
3
ObjectDisposedException on postAsync canceled
2
Xamarin Forms: Waits for NavigationPage.PushAsync crashes the application
1
Mono Compatible OData v4 Client
1
Xamarin async Http client
0
Web request penalized
0
WebAPI POST without data crashes the application
0
Exception when navigating to another page in Xamarin formats using Prism and SignalR



All Articles
Loading...
X
Show
Funny
Dev
Pics