使用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;

解决了问题

相关推荐
阿琳a_22 分钟前
前端对WebSocket进行封装,并建立心跳监测
前端·javascript·vue.js·websocket
2501_915106322 小时前
Flutter、React Native 项目如何搞定 iOS 上架?从构建 IPA 到上传 App Store 的实战流程全解析
websocket·网络协议·tcp/ip·http·网络安全·https·udp
快乐觉主吖4 小时前
Unity的日志管理类
android·unity·游戏引擎
WarPigs11 小时前
Unity性能优化笔记
笔记·unity·游戏引擎
小白杨树树18 小时前
【WebSocket】SpringBoot项目中使用WebSocket
spring boot·websocket·网络协议
T.D.C18 小时前
【业务框架】3C-相机-Cinemachine
unity
Sherry00719 小时前
实时数据传输协议:WebSocket vs MQTT
前端·websocket
itachi-uchiha19 小时前
命令行以TLS/SSL显式加密方式访问FTP服务器
服务器·网络协议·ssl
Icoolkj20 小时前
WebRTC 与 WebSocket 的关联关系
websocket·网络协议·webrtc
moppol21 小时前
SSL/TLS握手全流程拆解:从“Hello“到“安全通道“的每一个字节
网络·安全·ssl