Unhandled exception. System.InvalidOperationException: Unable to configure HTTPS endpoint. Digital Ocean - AppPlatform

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:

  • Dockerfile:
FROM AS base

FROM AS build
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
COPY --from=publish /src/publish .
ENV ASPNETCORE_URLS="https://+:80;https://+:443;"
ENTRYPOINT ["dotnet", "Reservations.Api.dll"]
  • launchsettings.json
  "$schema": "",
  "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

I am out of ideas, so any help would be appreciated.

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
August 25, 2023

Hi there,

It seems like the .NET application is looking for an HTTPS certificate but isn’t able to find one. Since you’re deploying this in a Docker container, and on a DigitalOcean App Platform that manages the HTTPS termination itself, there shoudn’t a need to handle HTTPS within your container at all.

What you could do is to disable the HTTPS configuration from the application itself and let the App Platform handle the SSL termination:

  1. Remove HTTPS Configuration from the Application: Since the DigitalOcean platform should handle HTTPS for you, you might not need to configure HTTPS within the application itself. Update the ASPNETCORE_URLS environment variable to only include the HTTP URL, and remove the HTTPS redirection middleware (app.UseHttpsRedirection();) from your application startup.

    Update the Dockerfile to have:

    ENV ASPNETCORE_URLS="http://+:80;"
  2. Remove Unnecessary Certificate Commands: Since you’re not handling HTTPS in your application, you can remove the RUN dotnet dev-certs https line from your Dockerfile, as it’s not needed.

  3. Update the launchsettings.json: Make sure that the launch settings are consistent with the environment variables and expose the right URLs. If you are not using HTTPS within the container, ensure that all configurations reflect that.

Hope that this helps!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.

This promotional offer applies to new account only.

© 2023 DigitalOcean, LLC.