For 3 hours I was dealing with the title error nothing seems to work until I read the answer from hikrikunen where the key was deleting the localhost certificates in the system keychain and then running
dotnet dev-certs https –clean
and then
dotnet dev-certs https -t
Uptil the point of deleting the localhost certificates, the dotnet dev-certs commands were not getting me anywhere, telling me that there was no cert available, but refusing to add because there was a certificate available. Strange but I don’t understand fully what happened but now my API can be run on https locally again 🙂