0

I am using dotnet CLI to run projects through a Powershell script. There is an SSL notification that pops up when we load the solution for the first time, which gives Yes/No options. I want to accept that or set the SSL to true using dotnet CLI.

This is the error that occurs when SSL is not enabled,

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.
at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
Shujath
  • 846
  • 1
  • 8
  • 22

2 Answers2

0

Before executing HTTPS Request. Add below Line of code. It will resolve the issue

System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
Tech-leo
  • 62
  • 5
0

Basically, the SSL needed to be trusted. The Project was able to execute without any iisSettings as well.

This commands helps in trusting the ssl certificates.

dotnet dev-certs https --trust

This Blog and GitHub issue helped me a lot.

Shujath
  • 846
  • 1
  • 8
  • 22