使用Fleck的WebSocketServer遇到的一个问题

复制代码
2024/5/22 11:11:46 [Warn] Failed to Authenticate System.AggregateException: One or more errors occurred. (Authentication failed, see inner exception.)
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090302): 要求的函数不受支持
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
   at System.Net.Security.SslStream.ProcessAuthenticationWithTelemetryAsync(Boolean isAsync, Boolean isApm, CancellationToken cancellationToken)
   at System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
   --- End of inner exception stack trace ---
2024/5/22 11:11:46 [Warn] Failed to Authenticate System.AggregateException: One or more errors occurred. (Authentication failed, see inner exception.)
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090302): 要求的函数不受支持
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
   at System.Net.Security.SslStream.ProcessAuthenticationWithTelemetryAsync(Boolean isAsync, Boolean isApm, CancellationToken cancellationToken)
   at System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
   --- End of inner exception stack trace ---

Unity端使用https://github.com/psygames/UnityWebSocket 在编辑器里连接服务器是正常的,但是发布到WebGL测试报以上错误,进行了一下测试

1、重置winsock,无效。执行命令:netsh winsock reset 并重启服务器。https://blog.csdn.net/yangguosheng/article/details/116010754

2、忽略检测证书,无效。https://blog.csdn.net/lizaijinsheng/article/details/127321758

后来浏览到https://rainmakerho.github.io/2020/05/15/2020007/https://cloud.tencent.com/developer/ask/sof/106307479/answer/106010378,应该是SSL版本问题,

代码添加server.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;

解决了问题

相关推荐
今晚务必早点睡12 小时前
系统通信方式实战详解:HTTP、RPC、MQ、WebSocket 各用在什么场景?(附 SDK 示例)
websocket·http·rpc
weixin_4242946714 小时前
在Unity中,摄像机移动时出现“残影”或“闪烁”是常见问题,主要原因和处理方法。
unity·游戏引擎
天人合一peng14 小时前
unity 3d 通过游戏对象的名子查到其对象
游戏·unity·游戏引擎
纯属个人爱好16 小时前
Unity2020+PicoNeo3Pro开发
unity·vr
*才华有限公司*17 小时前
RTSP视频流播放系统
java·git·websocket·网络协议·信息与通信
栗子叶18 小时前
网页接收服务端消息的几种方式
前端·websocket·http·通信
__water19 小时前
RHK《Unity接入DeepSeek问答》
unity·游戏引擎·智能问答·deepseek接入·deepseekapikey
康de哥21 小时前
MCP Unity + Claude Code 配置关键步骤
unity·mcp·claude code
美团骑手阿豪21 小时前
Unity3D大规模点击检测:GPU Picking vs MeshCollider + Raycast
unity
在路上看风景21 小时前
1.4 Unity运行时路径
unity·游戏引擎