I recently ran into the error “NET::ERR_CERT_DATE_INVALID” when running a dotnet core application via various tools included Visual Studio and the command line as shown below:
Having searched the internet and following many suggestions such as removing certifications from both the user cert store and the machine cert store, using dotnet dev-certs to clean and add a cert for the development environment, nothing worked.
I then came across the following post which had the answer, https://stackoverflow.com/questions/64618112/asp-net-core-keep-using-the-expired-certificate.
The steps I followed were:
- Clean the old certificate and generate a new trusted one. Run the commands listed below:
dotnet dev-certs https --clean
dotnet dev-certs https --trust
- Go to
%APPDATA%\Microsoft\UserSecretsand delete all of the directories
- Re-run the application. It should now run with no SSL errors