Friday, September 10, 2021

how to fix "The SSL connection could not be established," in Web Api development with ASP.Net Core and .Net 5.0

I implemented two MicroServices in my local machine,  I try to call one service from another with HttpClient. the error was shown as blew after the service call.

"cound not send data to commandservice with errror The SSL connection could not be established, see inner exception. System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot   at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)

   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)"

the error indicated that th SSL connection cannot be established due to certificate issue.

we can the  use the following command to trust the self-singed certificate

dotnet dev-certs https --trust

for more information about this command you can check out the microsoft document website with the link below


https://docs.microsoft.com/en-us/dotnet/core/additional-tools/self-signed-certificates-guide

No comments:

Post a Comment