I have followed this tutorial to create a self-signed CA certificate and then a self-signed SSL certificate based off the CA certificate. I then installed the SSL certificate in IIS to access my internal site via a local IP address e.g. 10.0.0.1. I want to use HttpClient
to make a request to the site as follows:
using (var httpClient = new HttpClient())
{
var text = await httpClient.GetStringAsync("https://52.19.32.61:5010");
}
I have added my self-signed CA certificate to the local machines trusted root certificates, however, I still get the following exception (Any answers telling me to turn off SSL validation are not helpful.):
System.Net.Http.HttpRequestException: An error occurred while sending the request. System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.