question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom launchSettings.json profile causes "Unable to configure HTTPS endpoint. No server certificate was specified"

See original GitHub issue

Description

When creating a new standard blazor serverside (with docker) project, and adding the following to launchSettings.json:

"DockerTest": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "publishAllPorts": true,
      "useSSL": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "TEST"
      }
    }

I basically copied the entry for Docker, renamed Docker to DockerTest and added the environmentVariables

Then selecting that particular profile and run it, I get the following exception: image

Happens both in Chrome and Firefox

App runs fine if I use the default Docker profile.

I tried to do what the exception said; and this is what the developer console spit out: image

Configuration

I’m running .net 5.0.300 on windows 10, 20H2 build 19042.985 Visual Studio 2019 - 16,10,0

System.InvalidOperationException HResult=0x80131509 Message=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. Source=Microsoft.AspNetCore.Server.Kestrel.Core StackTrace: at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action1 configureOptions) at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<BindAsync>d__32.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<StartAsync>d__291.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at Admin.Program.Main(String[] args) in C:\Devops\ST-Test\Admin\Program.cs:line 16

This exception was originally thrown at this call stack: Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions, System.Action<Microsoft.AspNetCore.Server.Kestrel.Https.HttpsConnectionAdapterOptions>) Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions) Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBindContext) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions>, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBindContext) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) … [Call Stack Truncated]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
javiercncommented, Jun 2, 2021

@Pilchie It’s a combo between the custom environment and Docker.

The way docker works from VS requires the environment to be Development. Otherwise we don’t try to probe the filesystem for the developer certificate (for security reasons).

When you use a custom environment you need to setup the certificate explicitly via config.

We have docs here and here on how to do this setup.

0reactions
Kla3muscommented, Jun 14, 2021

Hmm…

If I had three environments. Development, Staging and Production. Would that also be considered “advanced setup”? Is it so that the only valid profile that is supposed to work with docker is the Development profile? And everything else is considered “advanced” ? I find this very strange. Why even have profiles if this is the case?

As for suggestion, I will repeat a question that has gone unanswered earlier; “Further, in both articles, they try to reference this certificate on my local machine, but if I have to create these by myself locally on my machine, won’t this have to be re-done whenever someone else gets the solution to their computer?”

The suggestion you have, will that work across development machines and setups? The way I understand it is that all the developers have to export a certificate to a folder, map it to the container, then update the user-secrets…

Is this correct?

@javiercn

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to configure HTTPS endpoint. No server certificate ...
Solution · Run certmgr. · Then run dotnet dev-certs https -t a single time to create and trust a new development certificate. ·...
Read more >
Unable to configure HTTPS endpoint. No server certificate ...
The issue I'm about to describe happens debugging in Rider, VS, dotnet run, etc. The full error message is: Unable to configure HTTPS...
Read more >
Configure endpoints for the ASP.NET Core Kestrel web ...
The launchSetting. json file is only used in local development. If there's no endpoint configuration, then Kestrel binds to http://localhost: ...
Read more >
Docker in Visual Studio: 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...
Read more >
Unable to configure HTTPS endpoint. Digital Ocean - ...
I am trying to deploy a .NET Core 6.0 project to Digital Ocean using Apps Platform. But time and time again I am...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found