gpt4 book ai didi

c# - 尝试下载 osu! 时如何修复 "The SSL connection could not be established, see inner exception."化身

转载 作者:太空宇宙 更新时间:2023-11-03 12:07:18 27 4
gpt4 key购买 nike

我要下载osu!头像使用它们,但不断收到此错误:

The SSL connection could not be established.

内部异常是:

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: Получено непредвиденное сообщение или оно имеет неправильный формат

示例网址: https://a.ppy.sh/10638551?1524507784.png

我尝试使用 HttpClient 和 WebClient 但没有成功。

using(HttpClient client = new HttpClient())
{
var resp = await client.GetAsync("https://a.ppy.sh/10638551?1547998515.jpeg");
var responseStr = await resp.Content.ReadAsStringAsync();
File.WriteAllText("html/avatars/avatar.jpeg", responseStr);
}

最佳答案

我找到了这个博客帮助我的解决方案

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) =>
{
// local dev, just approve all certs
if (development) return true;
return errors == SslPolicyErrors.None ;
};

https://www.khalidabuhakmeh.com/validate-ssl-certificate-with-servicepointmanager

关于c# - 尝试下载 osu! 时如何修复 "The SSL connection could not be established, see inner exception."化身,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54297514/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com