Cannot find the certificate in either the LocalMachine store or the CurrentUser store

13,340

Solution 1

That means,

  • probably you have the wrong certificates installed.
  • you installed the certificates to the wrong place.

An easy way to tell if you have a client certificate installed properly is

  1. launch IE.
  2. Open Tools | Internet options.
  3. In Content tab, click Certificates button.

Then you should see the cert in Personal (read cert path and see whether it contains errors), and will be able to use it in your WinForms application.

Solution 2

I experienced similar issue. In my case it was solved by using MMC and giving Full control rights of the certificate for user IIS_IUSRS. My Website is running under ApplicationPoolIdentity. This answer guided me to the right path: How to give ASP.NET access to a private key in a certificate in the certificate store?

enter image description here

Solution 3

I had the same error when trying to connect to a service that hadn't been set to use SSL. Once I change the configuration of the service to use SSL, the connection worked fine.

Also you may get that error if the account doesn't have access to the private key, which WinHttpCertCfg.exe from the Windows Resource Kit can solve.

Share:
13,340
TNA
Author by

TNA

Updated on June 05, 2022

Comments

  • TNA
    TNA almost 2 years

    I have already installed the ssl cert in user PC. And, I also imported the cert under Local computer of Trusted Root Certification Authorities. I am trying to consume the web servcie. In my code I attach the cert as below.

    webservice.ClientCertificates.Add(X509Certificate.CreateFromCertFile(certPath));
    

    But I got the following error.

    Cannot find the certificate in either the LocalMachine store or the CurrentUser store

    What could be the issue? I'm using .Net Framework 2.0. So, not able to use WCF. Thanks.