1

I'm running Visual Studio 2022, and have Docker Desktop installed (Linux Containers).

When I go file -> new project -> ASP.NET Core Web App and have Configure for HTTPS ticked, Enable Docker ticked and Docker OS as Linux. And then try and Debug the a application with Docker profile selected. Debug settings

I get the following error:

Error

It says to look at the container tools output but there is nothing that says any error.

Looking at other things people suggest running:

dotnet dev-certs https --clean

dotnet dev-certs https --trust

Which I have done and can see the localhost certificate in the Cert store (Personal & Trusted). But it still results in exactly the same error as above.

I see suggestions to export the certificate via:

dotnet dev-certs https -ep %APPDATA%\ASP.NET\Https\WebApplication1.pfx -p 2e20670b-2656-4d5f-8e5b-b6d782b20113

With 2e20670b-2656-4d5f-8e5b-b6d782b20113 being the UserSecretsId of the project. And I can see the WebApplication1.pfx certificate, a strange thing is that everyone refers to the UserSecrets file having an entry for "Kestrel:Certificates:Development:Password"

But mine is empty. I've tried adding an entry:

{
  "Kestrel:Certificates:Development:Password": "2e20670b-2656-4d5f-8e5b-b6d782b20113"
}

But it still results in the same error.

Please help as I have been going insane with this for the past 4 days.

1
  • I was getting this same error and finally figured out I had a duplicate key in my secrets.json file. It must have been preventing VS from adding the Kestrel section. Thought this might help someone else. Commented Apr 22, 2024 at 21:23

1 Answer 1

0

I had the same issue after I added another Web API project to my solution and migrated code from the old Web API. I also spent several hours trying to find the problem.

In the end, it was resolved by deleting everything from the %APPDATA%\Microsoft\UserSecrets folder and adding a UserSecretsId to the new project's .csproj file:

<PropertyGroup>
  <UserSecretsId><Paste any random guid here></UserSecretsId>
</PropertyGroup>

Just in case, clean the certificates as well:

dotnet dev-certs https --clean
dotnet dev-certs https -t
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.