No I couldn’t
About "The SSL connection could not be established, see inner exception" issue in Windows Server 2012 R2
Hello there,
I currently working a web with ASP.NET Core.
I have an issue with deployed code in Windows Server 2012 R2.
Some code with task to take a data from certain endpoint did not work as expected (I use HttpWebRequest).
The code always return "The SSL connection could not be established, see inner exception" with inner exception "Authentication failed, see inner exception" with inner exception "The message received was unexpected or badly formatted".
I have tried it on local, and the code is working without any issue.
Is there anything I have to do for the code to be worked on the server?
This is the snipped code
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
req.KeepAlive = false;
req.Method = "GET";
req.ContentType = "application/json";
req.MediaType = "application/json";
req.Accept = "application/json";
req.Headers.Add("apikey: " + Startup.user);
req.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
responseFromServer = reader.ReadToEnd();
}
Let me know if I miss something for you to understand the questing.
Thanks