Hi everyone,
First, some background: I'm maintaining a content filter that was built with C# / .NET 4.6.1 / .NET Standard
I'm currently running into an issue where .NET fails to open a secure channel to a particular website. The URL I'm trying to access with C# is https://portal.worldpay.us
Here's the error I'm getting:
Exception: System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task`1.get_Result() at InternetTesting.Program.Main(String[] args) in c:\users\kent friesen\source\repos\InternetTesting\InternetTesting\Program.cs:line 22 ---> (Inner Exception #0) System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) --- End of inner exception stack trace ---<---The portal.worldpay.us is encrypted with TLSv1 and an AES-128SHA cipher, according to OpenSSL.
Code which replicates the problem:
class Program { static void Main(string[] args) { HttpClient client = new HttpClient(); HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, "https://portal.worldpay.us"); HttpResponseMessage response = null; try { response = client.SendAsync(message).Result; } catch(Exception ex) { Console.WriteLine("Exception: {0}", ex); } if (response != null) { Console.WriteLine("Response {0}", response.StatusCode); } Console.ReadKey(); } }
At first, I thought it was an Schannel problem, but now I'm not sure, because no Schannel error appears in event viewer, and I am able to access the site with IE11 and Edge just fine.
Does anyone have any ideas what the problem might be? I'd be inclined to say there's a bug somewhere in the .NET software stack, but I'd like to be proven wrong.
Thanks
Edit: Tested with .NET 4.6.1, 4.7.2 and got the same results. Testing with .NET Core 2.0 worked, but that's not an option for a short-term fix.