Websocket server is not starting without admin rights

282 views Asked by At

My websocket server is not starting. I cannot connect. But if I run program with admin rights It's working.

            X509Certificate2 certificate = new X509Certificate2(Resource.UZCRYPTO);
            using (X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser))
            {
                store.Open(OpenFlags.ReadWrite);
                if (!store.Certificates.Contains(certificate))
                    store.Add(certificate);
            }

            X509Certificate2 cert = new X509Certificate2(Resource._127_0_0_1, "1", X509KeyStorageFlags.MachineKeySet);
            //WebCoket set
            WebSocketServer wssv = new WebSocketServer(IPAddress.Parse("127.0.0.1"), 4141, true);
            wssv.SslConfiguration.ServerCertificate = new X509Certificate2(cert);
            wssv.SslConfiguration.EnabledSslProtocols = SslProtocols.Tls11 | SslProtocols.Tls12;
            wssv.AddWebSocketService<WebSocketEcho>("/");
            wssv.KeepClean = false;
            wssv.Start();
0

There are 0 answers