0

I wanted to create a custom environmenet variable name: ASPNETCORE_ENVIRONMENT=Local The reason for this is that I would like to have different settings for local machine and development server.

The appsettings.Local.json was read as expected but he process failed when calling app.Run();.

The error:

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

Even execution the above mentioned commands, the certificates were not generated successfully and the app does not run.

Running command dotnet dev-certs https --trust --check --verbose:

dotnet dev-certs https --trust --check --verbose
[1] Listing certificates from CurrentUser\My
[2] Found certificates: 1 certificate
    1) 6D093AE1029D800C250535B9094AF57DF65DF510 - CN=localhost - Valid from 2023-03-14 13:42:52Z to 2024-03-13 13:42:52Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[3] Checking certificates validity
[4] Valid certificates: 1 certificate
    1) 6D093AE1029D800C250535B9094AF57DF65DF510 - CN=localhost - Valid from 2023-03-14 13:42:52Z to 2024-03-13 13:42:52Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[5] Invalid certificates: no certificates
[6] Finished listing certificates.
[1] Listing certificates from CurrentUser\Root
[2] Found certificates: 1 certificate
    1) 6D093AE1029D800C250535B9094AF57DF65DF510 - CN=localhost - Valid from 2023-03-14 13:42:52Z to 2024-03-13 13:42:52Z - IsHttpsDevelopmentCertificate: true - IsExportable: false
[3] Checking certificates validity
[4] Valid certificates: 1 certificate
    1) 6D093AE1029D800C250535B9094AF57DF65DF510 - CN=localhost - Valid from 2023-03-14 13:42:52Z to 2024-03-13 13:42:52Z - IsHttpsDevelopmentCertificate: true - IsExportable: false
[5] Invalid certificates: no certificates
[6] Finished listing certificates.
A trusted certificate was found: 6D093AE1029D800C250535B9094AF57DF65DF510 - CN=localhost - Valid from 2023-03-14 13:42:52Z to 2024-03-13 13:42:52Z - IsHttpsDevelopmentCertificate: true - IsExportable: true

I couldn't find any documentation about that.

gtu
  • 707
  • 1
  • 10
  • 22
  • Check this: https://stackoverflow.com/questions/53300480/unable-to-configure-https-endpoint-no-server-certificate-was-specified-and-the – D A Mar 14 '23 at 11:59
  • Could you please tell me where you run the application? Inside VS or else? By using the kestrel or else? – Brando Zhang Mar 14 '23 at 12:38
  • I run it from VS with support of docker-compose. I belive that inside container Kestrel is used. The app runs successfully when `ASPNETCORE_ENVIRONMENT=Development`. – gtu Mar 14 '23 at 12:44

0 Answers0