开发者

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

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(X509Certific开发者_如何转开发ate.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.


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.


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?

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜