方法1:
X509Certificate2 x509 = new X509Certificate2(strPathPfx, strPasswordPfx);
改为X509Certificate2 x509 = new X509Certificate2(strPathPfx.ToString(), strPasswordPfx.ToString(), X509KeyStorageFlags.MachineKeySet)
方法2:
IIS应用池》高级设置 》修改加载用户配置文件 》True
原文链接:https://blog.csdn.net/qq_34894585/article/details/108386960