C# Mono ssl 问题

标签 c# ssl mono webrequest

好的,我正在使用以下代码:

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/

相关文章:

visual-studio - Xamarin.Android:包 XX 与 monoandroid81 不兼容(MonoAndroid,版本=v8.1)

c# - Dapper 如何通过 DynamicParameter.Get 处理 DBNull

c# - 命名代表 iCal 对象的类

c# - 在 Docker 中运行 Blazor

c# - 如何为 Listbox DataSource 实现一种方式绑定(bind)集合?

c# - Mono:如何(重新)抛出保留原始堆栈跟踪信息和收集本地数据的异常

ssl - paypal-wps 加密问题。 Paypal 错误 : We were unable to decrypt the certificate id

ssl - HAProxy 负载均衡器 : Peer's Certificate issuer is not recognized

ssl - 将客户端证书插入 HTTPS POST 请求

ios - iOS 上的蓝牙和播放列表