c# - IIS下如何填充系统证书?

标签 c# ssl ssl-certificate x509certificate digital-certificate

我需要填充系统证书。当我在 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/

相关文章:

c# - Include 中使用的 Lambda 表达式无效。 EF6,导航属性

c# - 元数据异常 : Unable to load the specified metadata resource

ssl - Twilio cURL 导致身份验证错误 - 未提供凭据

java - Android - 除了正常的 SSL 证书外,还验证自签名证书

ssl - 可以按需接收 TLS 服务器证书链吗?

ios - 在 ios 上,在 ionic 混合应用程序中,如何绕过证书检查(使用自签名证书)

c# - SetForegroundWindow 不适用于最小化进程

c# - 存储过程上的 OdbcCommand - 输出参数出现 "Parameter not supplied"错误

PHP Pear HTTP_Request 强制使用指定的 SSL 版本

android - OkHttp + Retrofit libssl 在两种方式的 SSL 身份验证中崩溃