Ssl aspnetcore docker和.pfx证书..如何?

Ssl aspnetcore docker和.pfx证书..如何?,ssl,docker,asp.net-core,Ssl,Docker,Asp.net Core,这就是我到目前为止在Program.cs中所做的 X509Certificate2Collection certs = store.Certificates.Find(X509FindType.FindByThumbprint, envConfiguration["certThumbprint"], true); X509Certificate2 cert = certs[0]; options.Listen(IPAddress.Any, hostUri.Port, (a => a.Use

这就是我到目前为止在Program.cs中所做的

X509Certificate2Collection certs = store.Certificates.Find(X509FindType.FindByThumbprint, envConfiguration["certThumbprint"], true);
X509Certificate2 cert = certs[0];
options.Listen(IPAddress.Any, hostUri.Port, (a => a.UseHttps(cert)));
然后,我使用

openssl pkcs12 -in [yourfile.pfx] -out [certificate.crt]
然后在我的Dockerfile中

FROM microsoft/aspnetcore
WORKDIR /app
COPY publish-output/. .
COPY certificates/. /usr/local/share/ca-certificates/
RUN update-ca-certificates
EXPOSE 5003
ENTRYPOINT dotnet <nameOfMyApp>.dll
但是当我尝试访问localhost:5003时,它给了我这个错误

fail: Microsoft.AspNetCore.Server.Kestrel[0]
      Uncaught exception from the OnConnectionAsync method of an IConnectionAdapter.
System.NotSupportedException: The server mode SSL must use a certificate with the associated private key.
fail: Microsoft.AspNetCore.Server.Kestrel[0]
      Uncaught exception from the OnConnectionAsync method of an IConnectionAdapter.
System.NotSupportedException: The server mode SSL must use a certificate with the associated private key.