Mono - HttpWebRequest over SSL - Error writing hea

2019-04-29 06:14发布

The below throws a System.Net.WebException - Error:SendFailure (Error writing headers) over SSL but works fine for http://www.google.com

using System;
using System.Web;
using System.Net;
using System.IO;

namespace HTTPS_Headers
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var request = (HttpWebRequest)WebRequest.Create ("https://www.google.co.uk/?q=mono");

            using(var reader = new StreamReader(request.GetResponse().GetResponseStream())) {

                Console.WriteLine (reader.ReadToEnd ());
            }

            Console.ReadLine();
        }
    }
}

I am running this on Mono 3.4.0/Lubuntu 14.04. Works fine over SSL on Windows/.NET 4.

标签: mono
1条回答
Root(大扎)
2楼-- · 2019-04-29 06:48

Try running the following on your machine to import trusted root certificates:

mozroots --import --sync
查看更多
登录 后发表回答