I have a C# class library that talks to an API over SOAP. Some of the methods in the API require a certificate. When I run the C# code stand alone, everything works as expected. I get the correct XML responses back from the API.

However, when I put the assembly in the GAC and call into it from C++, the calls that require a certificate start returning XML with fault messages. The calls that do not need a certificate still work as expected.

I am using a local X509 cert. When called from C++ it appears that the cert is not getting used to construct the HTTPS channel. The C# code that reads the .cer file is this:

obj.ClientCertificates.Add(
X509Certificate.CreateFromCertFile(@"C:\VR2.cer");

The file gets read in correctly and the obj does have the certificate after this line executes. I can't see any exceptions in my logs. Does anyone have any ideas why is not working?