- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我要下载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/
我是一名优秀的程序员,十分优秀!