X509证书 指定了无效的提供程序类型 System.Security.Cryptography.CryptographicException 错误解决方法

第一种解决办法:

IIS 应用程序池--选中你网站的所配置的应用程序池--右键 选择 “高级配置” --将“加载用户配置文件” 设置为True

第二种解决办法:

在加载证书方法时使用以下方法,请注意第三个参数

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

原文地址:https://www.cnblogs.com/gougou1981/p/11453242.html