Forum Discussion
Macos dotnet wacth https not working.
Hello;
I wanted to start Asp.net core Angular training. I am a Macos M1 user. I installed the necessary plugins with Vscode and created a webapi. But the api does not work with the dotnet watch command. It says the reason is https certificate problem.
launchSettings.json :
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5000;https://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
applicationUrl also only works when it is http.
In the error command:
Microsoft.Extensions.Hosting.Internal.Host[11]
Hosting failed to start
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.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
There is a long error like this. I enter the following commands in the terminal, in order:
1- dotnet dev-certs https
2- dotnet dev-certs https --trust
I approve the certificate.
When I say 3-dotnet dev-certs https --check, I get the error:
No valid certificate found.
I found the localhost certificates in Keychain Access and selected the always trust option. But I couldn't find a solution.
Also: dotnet dev-certs https --trust Trusting the HTTPS development certificate was requested. If the certificate is not already trusted we will run the following command: 'security add-trusted-cert -p basic -p ssl -k <<login-keychain>> <<certificate>>' This command might prompt you for your password to install the certificate on the keychain. There is an addition process like To undo these changes: 'security remove-trusted-cert <<certificate>>' I didn't know how to do it.
Can you help me with this?