I am trying to deploy a .NET Core 6.0 project to Digital Ocean using Apps Platform. But time and time again I am getting this exception:
Unhandled exception. System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
I’ve tried a lot of things and variations so far. Other resolutions to this exception suggest to run these commands on local machine:
dotnet dev-certs https --clean
dotnet dev-certs https --trust
But as this is deployment to app platform, I think that these won’t work. I’ve even tried sneaking in dotnet dev-certs https
command in Dockerfile but the same exception occurs.
Here’s what I’ve built so far:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["/Reservations.Api/Reservations.Api.csproj", "Reservations.Api/"]
COPY ["/Reservations.Application/Reservations.Application.csproj", "Reservations.Application/"]
COPY ["/Reservations.Persistance/Reservations.Persistance.csproj", "Reservations.Persistance/"]
COPY ["/Reservations.Security/Reservations.Security.csproj", "Reservations.Security/"]
COPY ["/Reservations.Domain/Reservations.Domain.csproj", "Reservations.Domain/"]
COPY ["/Reservations.UnitTests/Reservations.UnitTests.csproj", "Reservations.UnitTests/"]
RUN dotnet restore "Reservations.Api/Reservations.Api.csproj"
COPY . .
RUN dotnet build "Reservations.Api/Reservations.Api.csproj" -c Release -o /src/build
RUN dotnet dev-certs https
FROM build AS publish
RUN dotnet publish "Reservations.Api/Reservations.Api.csproj" -c Release -o /src/publish
FROM base AS final
WORKDIR /src
COPY --from=publish /src/publish .
EXPOSE 80
EXPOSE 443
ENV ASPNETCORE_URLS="https://+:80;https://+:443;"
ENTRYPOINT ["dotnet", "Reservations.Api.dll"]
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:44641",
"sslPort": 44366
}
},
"profiles": {
"Reservations.Api": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7202;http://localhost:5202",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://+:80;"
},
"httpPort": 8080,
"applicationUrl": "http://+:8080;"
}
}
}
In Program.cs app.UseHttpsRedirection();
is included.
Deployment logs error:
[2023-03-01 15:39:53] warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
[2023-03-01 15:39:53] No XML encryptor configured. Key {8cbcf317-aff6-4a80-90fa-539eeaf0de94} may be persisted to storage in unencrypted form.
[2023-03-01 15:39:53] Unhandled exception. System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
[2023-03-01 15:39:53] To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
[2023-03-01 15:39:53] For more information on configuring HTTPS see https://go.microsoft.com/fwlin
I am out of ideas, so any help would be appreciated.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!