У меня есть. Net Core API, который использует identityServer 4, я пытаюсь запустить API в Docker Compose (Windows Container), но не могу сделать из-за этого исключения, которое:
Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
Проведя часы в Google, я нашел много ссылок, в которых сначала нужно установить сертификат, например
dotnet dev-certs https --clean
dotnet dev-certs https --trust
**Docker - certificate not trusted**
1. Delete the C:\Users{USER}\AppData\Roaming\ASP.NET\Https folder.
2. Clean the solution. Delete the bin and obj folders.
3. Restart the Development tool. Visual Studio Code- 2019
После того, как все вышеперечисленное возникло с той же ошибкой, я что-то не так делаю.
Вот файл docker
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
user ContainerAdministrator
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
WORKDIR /src
COPY ../Certificate/idsrv3test.pfx .
COPY ["Tests-Identity/Tests-Identity.csproj", "Tests-Identity/"]
RUN dotnet restore "Tests-Identity/Tests-Identity.csproj"
COPY . .
WORKDIR "/src/Tests-Identity"
RUN dotnet build "Tests-Identity.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Tests-Identity.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Tests-Identity.dll"]
Вот docker -compose.override.yml
version: '3.4'
services:
tests-identity:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "5000:80"
- "5001:443"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:C:\Users\ContainerUser\AppData\Roaming\Microsoft\UserSecrets:ro
- ${APPDATA}/ASP.NET/Https:C:\Users\ContainerUser\AppData\Roaming\ASP.NET\Https:ro