SignalR : exception when calling HubProxy.Invoke method from a Xamarin.Forms app

enricomarraienricomarrai ITUniversity ✭✭

Hi, I am trying to fix an issue with a Xamarin.Forms app that should implement a chat functionality with SignalR server component deployed on an Azure App Service.

On the client side I have captured the exception message that you can see below :

StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Cache-Control: private
Transfer-Encoding: chunked
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 24 Jul 2017 17:05:37 GMT
Content-Type: text/html; charset=utf-8
}

The connection is established by the app with :

await hubConnection.Start();

The exception is generated at the first time the HubProxy.Invoke method is called :

await _chatHubProxy.Invoke("JoinRoom", Room.Id);

The Room.Id has a string value like '301aa3dd-9e89-428f-8949-96b65acbd7c5', but on the "Failed Request Tracing Log" in the Azure portal I have found this log message :

**[ArgumentNullException: Value cannot be null. Parameter name: s] System.IO.StringReader..ctor(String s) +12858724 **Microsoft.AspNet.SignalR.Json.JsonSerializerExtensions.Parse(JsonSerializer serializer, String json) +63 Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data, JsonSerializer serializer) +21 Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) +40 Microsoft.AspNet.SignalR.<>c__DisplayClass64"

The SignalR package on PCL project is Microsoft.AspNet.SignalR.Client 2.2.2.

Has anybody faced with this kind of issue with SignalR and Azure App Services ?

Thanks.

Answers

  • enricomarraienricomarrai ITUniversity ✭✭

    The exception has been resolved using "https" in the ApplicationUrl when the HubConnection is initialized with :

    new HubConnection(Constants.ApplicationURL);

Sign In or Register to comment.