首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Docker https问题无法启动Kestrel

Docker https问题无法启动Kestrel
EN

Stack Overflow用户
提问于 2021-07-08 17:43:15
回答 1查看 383关注 0票数 0

码头集装箱出了点问题。我正在尝试学习微服务架构,不幸的是在使用docker时遇到了问题。我研究了如何解决这个问题,但没有一个解决方案对我有帮助。

这是我的docker-compose.ovverride.yml:

代码语言:javascript
运行
复制
version: '3.4'

services:
  sourcingdb:
    container_name: sourcingdb
    restart: always
    volumes:
      - ./data:/data/db
    ports:
      - "27017:27017"
  esourcing.products:
    container_name: esourcingproduct
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_Kestrel__Certificates__Default__Password=madison
      - ASPNETCORE_HTTPS_PORT=44311
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/dev_cert.pfx
      - "ProductDatabaseSettings:ConnectionString=mongodb://sourcingdb:27017"
    depends_on:
      - sourcingdb
    ports:
      - "8000:80"
      - "443"
    volumes:
      - ~/.aspnet/https:/root/.aspnet/https:ro
      - ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro

我生成的证书位于projectfolder/conf.d/https/dev_cert.pfx

这是Docker错误。

代码语言:javascript
运行
复制
crit: Microsoft.AspNetCore.Server.Kestrel[0]

Unable to start Kestrel.

Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file

at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)

at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)

at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)

at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Certificates.CertificateConfigLoader.LoadCertificate(CertificateConfig certInfo, String endpointName)

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadDefaultCert()

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Reload()

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()

at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)

at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)

Unhandled exception. Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file

at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)

at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)

at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)

at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Certificates.CertificateConfigLoader.LoadCertificate(CertificateConfig certInfo, String endpointName)

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadDefaultCert()

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Reload()

at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()

at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)

at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)

at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)

at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)

at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)

at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)

at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)

at ESourcing.Products.Program.Main(String[] args) in /src/src/Services/Products/ESourcing.Products/Program.cs:line 16

我使用的是mac os docker: Docker版本20.10.5,内部版本55c4c88

dotnet 5.0.301

EN

回答 1

Stack Overflow用户

发布于 2021-07-08 19:24:01

我解决这个问题的方法是

  • ASPNETCORE_Kestrel__Certificates__Default__Password=madison
  • ASPNETCORE_HTTPS_PORT=44311
  • ASPNETCORE_Kestrel__Certificates__Default__Path=/https/dev_cert.pfx
  • ASPNETCORE_URLS=https://+:443;http://+:80
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68299194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档