'Cannot find X.509 certificate StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue ''

I have added the certificate to Trusted root certification Authorities. But still my code is giving this error when I start my REST service.

Error:

 Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue '<certificate name>'.

In Web.config, I have added the below tag:

<serviceCertificate findValue="<certificate name>"
                    x509FindType="FindBySubjectName"
                    storeLocation="LocalMachine" />
</serviceCredentials>

Please let me know if I am doing it incorrectly?



Solution 1:[1]

Go to "Manage computer certificates". Click that and you should get "certlm" window Expand personal folder and then certificate folder and look for the certificate you have provided in your web.config. I think your certificate name is wrong and that is why you getting this error.

my web.config setting is

and in my "certlm" window i got my certificate with name of device.DEVELOPMENT. look at the following image for my certificate infoenter image description here

Please mark it as answer if this solution helps you in solving ur problem

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Atul Chaudhary