如果没有管理员权利
我的Websocket服务器没有启动。我无法连接。但是,如果我使用管理权运行计划,则可以正常工作。
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();
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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论