【问题标题】:No server certificate was specified, and the default developer certificate could not be found or is out of date未指定服务器证书,默认开发者证书找不到或已过期
【发布时间】:2022-10-17 19:53:35
【问题描述】:

这是我的码头工人撰写:

version: '3.4'
services:
  identityserver:
    image: xxxx/identityserver:latest
    ports:
      - 5001:80
      - 5443:443
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_HTTPS_PORT=5443
    volumes:
      - ${APPDATA}\microsoft\UserSecrets:/root/.microsoft/UserSecrets
      - ${USERPROFILE}\.aspnet\https:/root/.aspnet/https

我用这个创建了我的证书:

dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\identityserver.pfx -p 20070237065
dotnet dev-certs https --trust

我还在我的 csproj 中安装了 usersecretid

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UserSecretsId>e9cf95df-89b8-43e8-b11f-9ae9a98c1e54</UserSecretsId>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Duende.IdentityServer" Version="6.1.2"/>
  </ItemGroup>
</Project>

然后运行这个来隐藏秘密:

dotnet user-secrets set "Kestrel:Certificates:Development:Password" "20070237065"

我也像这样构建我的文件:

docker build -t xxxx/identityserver .
docker push xxxx/identityserver:latest
docker-compose up -d

当最后一行 docker compose 运行时,我仍然收到此消息。

未处理的异常。 System.InvalidOperationException:无法 配置 HTTPS 端点。没有指定服务器证书,并且 找不到默认开发人员证书或已过期。

我想我已经完成了所有步骤,我忘记了什么。

【问题讨论】:

    标签: docker docker-compose dockerfile certificate pfx


    【解决方案1】:

    也许您错过了“ASPNETCORE_Kestrel__Certificates__Default__Path”值?

    【讨论】:

      猜你喜欢
      • 2019-04-17
      • 2020-05-01
      • 2021-10-27
      • 2016-11-18
      • 2013-11-03
      • 1970-01-01
      • 2013-06-04
      • 2013-01-05
      • 2012-03-24
      相关资源
      最近更新 更多