System.Security.Cryptography.CryptographicException when micro-channel interface calls refund: An internal error solution

 

 

from:https://www.cnblogs.com/ithome8/p/5189926.html

 

I summed up what appears certificate could not be loaded because the following three

1. The certificate password is incorrect, the password is the micro-channel business certificate No.

Solution: Check the certificate and the password is not the same merchant number

2.IIS set incorrectly, the user profile is not loaded

The solution: find the application pool to use the site -> right click -> Advanced Settings -> Open the following figure -> Select true in loading a user profile

clip_image001

3. If the above two solutions do not solve the problem, there may not be given the certificate store when loading identity certificate

Workaround: Use the following method when loading certificate method, please note that the third argument

X509Certificate2 cer = new X509Certificate2(cerPath, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
req.ClientCertificates.Add(cer);

Guess you like

Origin www.cnblogs.com/94cool/p/11540408.html