C
C#4mo ago
alecrim7k

✅ WebApi template doesn't run on https from the terminal but runs from VS Code's debug and run

I'm following the tutorial at MSLearn https://learn.microsoft.com/en-us/training/modules/build-web-api-aspnet-core/3-exercise-create-web-api . One of the steps is to call dotnet new ... and then dotnet run from the terminal. The expected output is a "Now Listening" message indicating the https port and another for http. When I run it from the terminal, only the http message is displayed. I followed the instructions on https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl#trust-the-aspnet-core-https-development-certificate-on-windows-and-macos and the commands worked on my PopOS but the terminal output is still the same. I executed a >.NET: Generate assets for build and debug in VSCode and both https and http work, but it still doesn't work on the terminal. What could be the issue?
Exercise - Create a web API project - Training
Learn how to create a web API project with ASP.NET Core.
Enforce HTTPS in ASP.NET Core
Learn how to require HTTPS/TLS in an ASP.NET Core web app.
9 Replies
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
alecrim7k
alecrim7kOP4mo ago
Awesome, I launched with -lp https and it worked, much appreciated. It still displays the message : warn: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[8] The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert. Should I be concerned?
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
alecrim7k
alecrim7kOP4mo ago
I did, followed all the instructions and rebooted. Still the same message. There's a section for Ubuntu that I followed the instructions too. My dotnet --info .NET SDK: Version: 8.0.108 Commit: 665a05cea7 Workload version: 8.0.100-manifests.109ff937 Runtime Environment: OS Name: pop OS Version: 22.04 OS Platform: Linux RID: ubuntu.22.04-x64 Base Path: /usr/lib/dotnet/sdk/8.0.108/ .NET workloads installed: Workload version: 8.0.100-manifests.109ff937 There are no installed workloads to display. Host: Version: 8.0.8 Architecture: x64 Commit: 08338fcaa5 .NET SDKs installed: 7.0.119 [/usr/lib/dotnet/sdk] 8.0.108 [/usr/lib/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download It doesn't show the ASP.NET Core message even though I followed all the instructions
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
alecrim7k
alecrim7kOP4mo ago
I know, I'm just showing that it doesn't produce the expected output
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
alecrim7k
alecrim7kOP4mo ago
I ran this command again:
dotnet linux-dev-certs install
Some operations require root. You may be prompted for your 'sudo' password.
Creating CA certificate.
Installing CA certificate.
Removing existing development certificates.
Creating development certificate.
Installing development certificate.
The development certificate was successfully installed.
ASP.NET Core applications may still print a warning at startup that the developer certificate is not trusted.
This is a false warning. The message is no longer printed with ASP.NET Core 9 preview 6+.
dotnet linux-dev-certs install
Some operations require root. You may be prompted for your 'sudo' password.
Creating CA certificate.
Installing CA certificate.
Removing existing development certificates.
Creating development certificate.
Installing development certificate.
The development certificate was successfully installed.
ASP.NET Core applications may still print a warning at startup that the developer certificate is not trusted.
This is a false warning. The message is no longer printed with ASP.NET Core 9 preview 6+.
Apparently it's a false warning Mistery solved, so it seems. Once again, much appreciated
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server