-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet 2.1.300 in centos 7 Error:The SSL connection could not be established, see inner exception System.Net.Http #26590
Comments
the code in the netcore 2.0 is ok |
could it be because that HTML page link does not work in browser too? |
This code is completely error-free in netcore 2.0. |
got:
with: using System;
using System.Net;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
using(var client = new System.Net.Http.HttpClient())
{
client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36");
Console.WriteLine(await client.GetStringAsync("https://www.23us.net/90/90325/23873102.html"));
}
}
} works fine with https://github.com, for example. How else can anyone reproduce this issue if your link https://www.23us.net/90/90325/23873102.html is broken? |
Experiencing this problem as well, running on Amazon AMI Linux |
@bujie are you hitting the same stack as https://github.com/dotnet/corefx/issues/30641 or something different? |
@bujie I can't repro with current master, 2.1.301, 2.1.300-preview1-008174, Please, copy the full callstack that you are getting. |
@pjanotti My project has been rolled back to dotnet core 2.0, temporarily solve this problem, I expect 2.1.302 can solve this problem |
the demo run in ubuntu 16.04(dotnet core 2.1.301) is okrun the Centos 7(2.1.301) is error Unhandled Exception: System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.) ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. |
Most of my runs on centos-7 2.1.301 were |
CentOS's curl (by default) uses NSS as the TLS backend, so it's possible that NSS was trusting a root cert that OpenSSL isn't. The easiest way I know of to diagnose it is to register a custom callback for validation and inspect the X509Chain object. X509ChainElementCollection elements = chain.ChainElements;
Console.WriteLine($"Chain built with {elements.Count} elements");
for (int i = 0; i < elements.Count; i++)
{
X509ChainElement element = elements[i];
Console.WriteLine($"Element {i}: {element.Certificate.GetNameInfo(X509NameType.SimpleName, false)}");
Console.WriteLine(" Status:");
foreach (X509ChainStatus status in element.ChainElementStatus)
{
Console.WriteLine($" {status.Status}: {status.StatusInformation}");
}
} I'm guessing it's UntrustedRootAuthority, which might be fixed by running |
@bujie @marekhanzlik were you able to inspect the X509Chain as @bartonjs suggested? |
Closing since we lack information to do anything about it. |
@h0730303779 can you please provide more details - can you reproduce it repeatedly? On more than 1 machine? Also, it is not clear if your problem is truly the same underlying problem as the original report - I would suggest to create a new one. In general we do not monitor comments on closed issues. |
My two centos cloud virtual machines are like this. |
I'm not really sure now (it was some time ago) but i think i've fixed this problem by installing CURL in my docker container (had this problem in container) |
Error: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
Code:
var http = new System.Net.Http.HttpClient();
http.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36");
http.GetStringAsync("https://www.23us.net/90/90325/23873102.html");
Normal in Centos7, most of them will produce this error, part of the URL is normal, this URL in the example will produce this error
Everything works fine under Windows
The text was updated successfully, but these errors were encountered: