Wcf – Cannot find the X.509 certificate using the following search criteria —-

iisiis-7wcfweb services

I created custom authentication by Wcf after that I created self-sign ssl in IIS 7.5

and use below code in web.config

<serviceCertificate findValue="CN = srv-erp"/>

and this one too

<serviceCertificate findValue="CN = srv-erp"
                                storeLocation="LocalMachine"
                                x509FindType="FindBySubjectName"
                                storeName="My"/>

and I used FindBySerialNumber too.

but they didn't work and I get this error

Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectDistinguishedName', FindValue 'CN = srv-erp'.

Your help is appreciated

Best Answer

it seems that problem in the findValue property try to change it to serv-erp. You don't need to place key of property in findValue when you use x509FindType.

<serviceCertificate findValue="srv-erp"
                            storeLocation="LocalMachine"
                            x509FindType="FindBySubjectName"
                            storeName="My"/>

Also you may try to find you certificate by another type (see X509FindType reference) For instance, by thumbprint

<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" 
                            findValue="b5 ca b7 d0 b8 da fd 20 b7 bb 14 5d 66 2b 53 f3 0c 20 ca f2"/>

Finally, ensure that your certificate is exist. Type Run in Search Windows and copy and paste certmgr.msc. Then on the menu click on Action -> Find certificates...

Related Topic