Title: ASP.NET Core serves expired certificate
Tags: asp.net-core;ssl;certificate;kestrel
Question: My SSL certificate for one of my websites expired on 23/1/2022. I renewed the certificate with the issuer, got all the new files (PEM,CRT), converted to PFX and replaced the original file at the server.
However, if I or anyone else visit the website, there is still warning of the invalid certificate and in the details in the browser I see the validity of the expired certificate.
I host my service in Ubuntu using Kestrel.
The configuration looks like this:
```  webBuilder.ConfigureKestrel(serverOptions =&gt;
                {
                    serverOptions.ConfigureHttpsDefaults(listenOptions =&gt;
                    {
                        X509Certificate2 certificate = new X509Certificate2(&quot;PKCS12_1556384.pfx&quot;, password);
                        listenOptions.ServerCertificate = certificate;
                    });
                });
```
I renamed the new certificate to keep the file name, so I do not need to recompile the source, replaced the original file (all the files related to the certificate, like the parent one I got from the issuer), rebooted the service couple of times, but nothing helped.



Here is another answer: In IIS, we can rebind the new certificate by ```Enable Automatic Rebind if Renewed Certificate```.
So the best practise should be how to rebind the renewed certificated.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2022:00:02/14/22', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<asp.net-core><ssl><certificate><kestrel>', 'Title': 'ASP.NET Core serves expired certificate', 'ViewCount': 129, 'id': 71116159, 'user_AboutMe': None, 'user_AccountId': 1336032.0, 'user_DisplayName': 'Jan Drozen', 'user_Reputation': 846.0, 'user_Views': 135.0, 'user_id': 1278777.0}}