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

12 篇文章 0 订阅
8 篇文章 0 订阅
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;
解决了问题

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Fleck WebSocket一个用C#编写的WebSocket库,用于在.NET框架中实现WebSocket通信。它提供了简单易用的接口和事件监听器属性,例如onopen、onerror、onclose和onmessage,用于处理WebSocket的连接和数据传输。通过使用Fleck WebSocket库,您可以方便地在低版本的.NET框架中进行WebSocket通信,并解析传输的数据。根据WebSocket的状态,可以使用readyState属性来判断WebSocket是正在尝试连接、已经建立连接、正在关闭连接还是已经关闭连接。使用Fleck WebSocket库可以大大简化在.NET框架中进行WebSocket通信的代码编写工作,并提供了更好的兼容性和稳定性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [C#工作总结(一):Fleck的WebSocket使用](https://blog.csdn.net/ZslLoveMiwa/article/details/80247739)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [C# Fleck的WebSocket使用](https://blog.csdn.net/chenxi004/article/details/102531865)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

地狱为王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值