好的,我正在使用以下代码:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += (send, cert, chain, sslPolicyErrors) => true;
string dlclresponse = "";
try
{
WebRequest wr = WebRequest.Create(url);
Stream stream = wr.GetResponse().GetResponseStream();
Debug.WriteLine("HTTPDEBUG:" + " Success");
dlclresponse = new StreamReader(stream).ReadToEnd();
}
catch (WebException we)
{
var ex = we as Exception;
while (ex != null)
{
Debug.WriteLine("HTTPDEBUG:" + ex.ToString());
ex = ex.InnerException;
}
}
我完全知道这只是忽略了 ssl 背后的安全性,但我似乎无法使用单声道在我的 Ubuntu 服务器上运行它。
无效的网址如下:
https://atarashii.toshocat.com/2.1/anime/schedule
它一直给我这个异常:
System.Net.WebException: Error: SendFailure (Error writing headers) ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
我读过很多书,但老实说我不太明白。
我做错了什么?这个解决方案的大部分答案都与上面类似,但它一直在崩溃。我从这里尝试了很多:
Mono https webrequest fails with "The authentication or decryption has failed"
但似乎没有人做任何事情;(。
目前我真的很想使用 curl hack,因为目前感觉无法解决。
我希望你们中的某个人可能有另一个想法可以帮助我。
提前致谢!
最佳答案
好吧,愚蠢的我。我实际上有一个旧版本的单声道,实际上是 4.2.1.102。只是不想和我一起工作。删除它并更新到最新版本修复它;/。告别浪费在寻找终极目标上的时间:你重新安装它修复了吗?
关于C# Mono ssl 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47379163/