Home > OS >  Websocket auto-self-sign certificate shows ERR_CERT_AUTHORITY_INVALID
Websocket auto-self-sign certificate shows ERR_CERT_AUTHORITY_INVALID

Time:06-09

Im trying to connect my blazor app to my server.

@page "/"
@inject IJSRuntime js
@inject HttpClient h

<butt @onclick="Connect">connect</butt>

@code {
public async Task Connect()
    {
        var cliente = new ClientWebSocket();
        var cts = new CancellationTokenSource();
        cts.CancelAfter(TimeSpan.FromSeconds(100));
        Uri uri = new Uri("wss://192.168.1.39:7000");
        await cliente.ConnectAsync(uri,cts.Token);
    }
}

im using this library :

System.Net.WebSockets.Client

and it shows this error :

dotnet.6.0.4.p9lwyok8ai.js:1 WebSocket connection to 'wss://192.168.1.39:7000/' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID

the server its working good.

CodePudding user response:

Webshocket secure "wss//" cant be used by auto-self signed certificate, then i cahnge the https to http and i used webshocket "ws//" to use http instead of https u need to change Client\Properties\launchSetings.json on "applicationUrl":"ur http" and the same on Server\Properties\launchSetings.json

  • Related