分享最实用的技术,创造更大的价值

解决微信支付api证书RSA加密错误

在调用微信支付使用到微信支付api证书时,在服务端始终报错


System.Security.Cryptography.CryptographicException: 系统找不到指定的文件。 在 System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) 在 System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) 在 System.Security.Cryptography.X509Certificates.X509Utils.LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle pCertCtx) 在 System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) 在 System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) 在 xxx.HttpService.Post(String xml, String url, Boolean isUseCert, Int32 timeout)


尝试很多办法,后来通过iis应用程序池设置搞定,但不知道原因。


应用程序池--》找到自己的应用程序(网站名称)-->右键-->高级设置-->在进程模型区域,有个-用户加载配置文件-选择后面为true.这个问题就解决了。


系统找不到指定的文件

联系
QQ
电话
咨询电话:189-8199-7898
TOP