I'm playing with Runscope using Mono 3 on the Mac. Using the code below I'm getting an exception:
System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
I don't understand why, as the ServicePointManager.ServerCertificateValidationCallback
should effectively approve all certificates.
Also note that the code works perfectly under Visual Studio on Windows.
Any ideas?
class Program
{
private static Uri url = new Uri("https://api-github-com-[MY_PERSONAL_TOKEN_HERE].runscope.net/");
static void Main(string[] args)
{
ServicePointManager.ServerCertificateValidationCallback +=
(sender, cert, chain, sslPolicyErrors) => true;
MakeRequest();
Console.ReadKey ();
}
private static async Task MakeRequest()
{
try
{
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(url);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine("Body: " + body);
}
catch(Exception ex)
{
Console.WriteLine (ex);
}
}
}