ASP.Net Core Docker WebAPI Error: The remote certificate is invalid according to the validation procedure

Last Reply 2 months ago By dharmendr

Posted 2 months ago

Hello all,

I have 2 .net core projects that work perfectly with each other when I run them normal, I have an API and a MVC UI. When I run them in docker containers, I go on my API with swagger, I figured out how to connect my postgres db and insert data successfully. When I go on my UI and I call the API I get this error:

An unhandled exception occurred while processing the request

AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch, RemotecertificateChainErrors.

I created a certificate and have it in my .net project. I am guessing I have to do something different to make this work with a container. (If this is what is wrong, I’m not sure yet.)

To put it in my normal project I did this.

.UseKestrel(serverOptions =>
{
    serverOptions.Listen(IPAddress.Loopback, 5010);
    serverOptions.Listen(IPAddress.Loopback, 5011, listenOptions =>
    {
        listenOptions.UseHttps("localpfx.pfx", "password");
    });
});

I have a Dockerfile in my .net core project. I am not using docker compose.

Any ideas how to get my UI to call my API both running in separate containers? This is the last part of my project.

Thank you.

You are viewing reply posted by: dharmendr 2 months ago.