NET::ERR_CERT_DATE_INVALID

Joe Blogs

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:

  1. Clean the old certificate and generate a new trusted one. Run the commands listed below:
    1. dotnet dev-certs https --clean
    2. dotnet dev-certs https --trust
  2. Go to %APPDATA%\Microsoft\UserSecrets and delete all of the directories
  3. Re-run the application. It should now run with no SSL errors