请教websocket-sharp的问题?
websocket-sharp 需要配置一行:
在win7下正常工作,windows server 2008却不能工作,报错
An error occured - Message: An exception has occurred while connecting. , Exception: WebSocketSharp.WebSocketException: An error has occurred while handshaking. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
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.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at WebSocketSharp.WebSocket.setClientStream()
--- End of inner exception stack trace ---
at WebSocketSharp.WebSocket.setClientStream()
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()Connection closed: An error has occurred while handshaking.
请教解决办法
ws.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls;
在win7下正常工作,windows server 2008却不能工作,报错
An error occured - Message: An exception has occurred while connecting. , Exception: WebSocketSharp.WebSocketException: An error has occurred while handshaking. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
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.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at WebSocketSharp.WebSocket.setClientStream()
--- End of inner exception stack trace ---
at WebSocketSharp.WebSocket.setClientStream()
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()Connection closed: An error has occurred while handshaking.
请教解决办法
...全文
相关推荐
C#实现WebSocket协议客户端和服务器websocket sharp组件实例解析
在使用WebSocket Sharp时,可以通过以下方式创建和操作WebSocket实例:1.
websocket-sharp
WebSocket-sharp是一个C#实现的WebSocket客户端库,它允许开发者在.NET环境中轻松地创建WebSocket连接。
websocket-sharp.dll文件
该文件是websocket-sharp项目的打包文件,导入到C#项目中可以便捷的实现websocket连接功能。十分的方便,源码在github上https://github.com/sta/webso
websocket-sharp.dll
WebSocket-Sharp.dll是一个针对.NET Framework开发的WebSocket类库,它为C#程序员提供了一种方便的方式来实现WebSocket协议。
C# WebSocket-Sharp 全解析:7个关键步骤教你轻松搭建WebSocket服务器与客户端!
除了基本的消息传递外,消息压缩:可以通过设置属性启用压缩,减少传输的数据量。HTTP身份验证:允许设置用户名密码,增强安全性。通过HTTP代理服务器连接:当需要穿越防火墙或NAT时非常有用。经过上述讲解,相信你现在应该对如何使用C#中的有了较为全面的理解。无论是作为新手入门还是希望进一步深入研究,这篇文章都希望能够为你提供有价值的参考。记住,编程的世界里没有绝对的标准答案,关键是找到最适合当前需求的方法。希望今天的分享能够帮助你在未来的项目中写出更加优雅、高效的代码!


