I have never run into this problem before, but I just realized that in WCF applications when I provide a certificate reference with FindBySubjectName - it can fail if you have two similarly named (not identical) certificates. I don't think this is by design, it has to be a bug, but I found a workaround.
Short and Sweet...here it is. If I have a certificate reference like this for "RP":
<certificateReference findValue="RP" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
But, I also have a cert named "RPSTS" in the same cert store, the lookup fails because it can't find a unique cert by the name RP. I don't know about you but I think "RP" and "RPSTS" are pretty unique...but not as far as WCF is concerned. I usually use FIndByThumbprint for production code, but for code samples and reference materials I want it to be obvious which cert we are dealing with, it is hard enough to trouble-shoot certs without having to look up thumbprints every time.
A workaround for this is to use FindBySubjectDistinguishedName so this works even if I have "CN=RP" and "CN=RPSTS" in my cert store.
<certificateReference findValue="CN=RP" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName"/>
Shweet!
Remember Me
Designed by NUKEATION STUDIOS