javascript - Websocket-shark ssl/tls 证书
问题描述
我正在尝试使 websocket 服务器与 html (.js) 客户端一起工作。问题是 https 需要 ssl/tls 连接。我试过这个,但它不起作用。
var wssv = new WebSocketServer ({port}, true);
wssv.SslConfiguration.ServerCertificate =
new X509Certificate2 ("{/path/to/cert.pfx}", "{password for cert.pfx}");
有谁知道这段代码有什么问题?
我收到此错误:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at WebSocketSharp.Net.WebSockets.TcpListenerWebSocketContext..ctor(TcpClient tcpClient, String protocol, Boolean secure, ServerSslConfiguration sslConfig, Logger logger)
at WebSocketSharp.Ext.GetWebSocketContext(TcpClient tcpClient, String protocol, Boolean secure, ServerSslConfiguration sslConfig, Logger logger)
at WebSocketSharp.Server.WebSocketServer.<>c__DisplayClass71_0.<receiveRequest>b__0(Object state)
解决方案
推荐阅读
- c# - 将字节数组解析为结构
- typescript - 如何使用 Typescript 编写具有可迭代约束的泛型类型
- multithreading - 异步线程从单个源读取,循环样式,并写入单个目标,按顺序
- java - 如何获取丢弃的图像 x 和 y 坐标?
- python - 如何对 groupby 结果的第一个值求和并将其写为相关组中的 df 列
- c - Matlab 中的 mxArrayToString() 函数
- regex - 当在整个字符串中找不到特定单词时如何获得不“命中”?
- ios - iOS 13 中的 UISearchBar 在关闭 (x) 按钮旁边有一个小黑点
- python - python中的拆分函数以将字符串与逗号分开
- flutter - 仅滚动特定容器