chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.63k stars 550 forks source link

WSS on Blazor WASM .NET 8 #287

Closed tomer-asensus closed 6 months ago

tomer-asensus commented 6 months ago

Hi,

I'm trying to use secured web sockets (based on "Example: WebSocket chat client") on Blazor WASM .NET 8.

I received the following exception in runtime:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: System.Security.Cryptography.X509Certificates is not supported on this platform.

which is triggered from this line of code:

var context = new SslContext(SslProtocols.Tls12, new X509Certificate2("file.pfx", "some password"), (sender, certificate, chain, sslPolicyErrors) => true);

Is there any workaround to use wss on this platform ?

Thank you.