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

解决了问题

相关推荐
HELLOMILI3 小时前
第四章:反射-Reflecting Your World《Unity Shaders and Effets Cookbook》
游戏·unity·游戏引擎·游戏程序·图形渲染·材质·着色器
末零7 小时前
Unity 取色板
unity·游戏引擎
无敌最俊朗@7 小时前
Unity大型游戏开发全流程指南
unity·游戏引擎
虾米神探7 小时前
Unity InputField + ScrollRect实现微信聊天输入框功能
unity·游戏引擎
咩咩觉主9 小时前
C# &Unity 唐老狮 No.7 模拟面试题
开发语言·unity·c#
咩咩觉主9 小时前
Unity网络开发基础 (2) 网络协议基础
网络·unity·c#
Tatalaluola10 小时前
Unity实现在镜子间反射光柱
unity·c#·游戏引擎
真正的醒悟18 小时前
SSL-VPN案例
网络·windows·ssl
愚公搬代码20 小时前
【愚公系列】《Python网络爬虫从入门到精通》045-Charles的SSL证书的安装
网络·爬虫·python·网络协议·ssl
君莫愁。1 天前
【Unity】搭建基于字典(Dictionary)和泛型列表(List)的音频系统
数据结构·unity·c#·游戏引擎·音频