我需要填充系统证书。当我在 VS 下调试时,相同的源代码告诉我证书计数正确。我在IIS 7.5 Windows 7下运行代码,.Count总是返回0,是不是权限问题?为什么计数返回 0?
System.Security.Cryptography.X509Certificates.X509Store store = new System.Security.Cryptography.X509Certificates.X509Store(System.Security.Cryptography.X509Certificates.StoreName.My);
store.Open(System.Security.Cryptography.X509Certificates.OpenFlags.ReadOnly);
Response.Write("<hr>Certs count: " + store.Certificates.Count.ToString() + "<br>");
最佳答案
IIS 和 VS 调试器在不同的用户凭据下运行。因此 IIS 无法加载证书。这是我的解决方法:
我将制作一个命令行实用程序和 run it as user
关于c# - IIS下如何填充系统证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14974288/