I\'m making an application that involves a website on localhost as a user interface with Asp.net Core and SignalR Core.
My problem is that I get an authentication ex
When connecting to HTTPS to ignore SSL certificate in SignalR Core client you should do this in HttpMessageHandlerFactory
configs. Use HttpConnectionOptions
in WithUrl
method like this:
connection = new HubConnectionBuilder()
.WithUrl("https://localhost:443/MiniLyokoHub", (opts) =>
{
opts.HttpMessageHandlerFactory = (message) =>
{
if (message is HttpClientHandler clientHandler)
// bypass SSL certificate
clientHandler.ServerCertificateCustomValidationCallback +=
(sender, certificate, chain, sslPolicyErrors) => { return true; };
return message;
};
})
.Build();
It seems that the SignalR Core Client is also subject to Https redirection Which is why it wouldn't connect to the http port.
For my use case, I just had to disable it in Startup.cs