HELP! Hosting .netcore https site inside docker container.

Im currently running a dev container for my .net core project. After following the directions found here:

I can get my site working, so for if example I nav to lhttps://localhost:5001/swagger/index.html then I see my swagger config. Perfect!

Also, if I nav to https://localhost:5001/.well-known/openid-configuration my config comes up! Great!

Its worth noting that both of these are showing the appropriate self signed dot net dev cert so I think we are good there.

But if I try to hit, say for example https://localhost:5001/api/Store/GetMyOwnedStores?username=jcianci12 from inside my app, here is what happens:

The error I get is:

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: ‘https://localhost:5001/.well-known/openid-configuration’.
—> System.IO.IOException: IDX20804: Unable to retrieve document from: ‘https://localhost:5001/.well-known/openid-configuration’.
—> System.Net.Http.HttpRequestException: 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(ReadOnlySpan`1 alert, ExceptionDispatchInfo exception)
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
— End of inner exception stack trace —

Now here is where it gets interesting. If I debug watch this locally, instead of inside the container. It works fine!

The project is at https://github.com/jcianci12/dockerwehireit if you can help.

I suspect there is something I am not understanding with how .net core is interacting with the container and the trusted root cert chain… Any help would be appreciated!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *