Search code examples
.netuwpsignalrsignalr-hubsignalr.client

Getting "The certificate authority is invalid or incorrect" when connecting to SignalR (Core) hub in UWP


I'm trying to connect to a SignalR Core hub from my UWP application.

In a .NET Core application (2.1) it works perfectly, whereas in UWP it throws an exception when hub.StartAsync() is called.

The certificate authority is invalid or incorrect

This is my code:

hub = new HubConnectionBuilder()
    .WithUrl("http://localhost:49791/hubs/status")
    .Build();

await hub.StartAsync();

What's going on?

I set guess I have to configure something in the Package Manifest, but what?


Solution

  • OK, I got into SignalR's Gitter Chat and one kind user has pointed me out the fix. Kudos to him. Here is the excerpt of the conversation.

    Andrew Stanton-Nurse (@anurse): Is your application using SSL? The URL seems to be http but this error should only occur when using a self-signed SSL certificate

    José Manuel Nieto @SuperJMN I'm not sure! I'm using the default ASP. NET Core template for Wep API. How can I check it? Thank you for the quick response! 😃

    Andrew Stanton-Nurse @anurse try just navigating to the URL in a browser, does it redirect you to https://localhost:...?

    José Manuel Nieto @SuperJMN OK, I discovered the problem here 👇

    Snapshop

    For it to work, this has to be unchecked 😃