【问题标题】:Cannot find the X.509 certificate using the following search criteria ----使用以下搜索条件找不到 X.509 证书----
【发布时间】:2015-08-04 11:08:02
【问题描述】:

在 IIS 7.5 中创建自签名 ssl 之后,我通过 Wcf 创建了自定义身份验证

并在 web.config 中使用以下代码

<serviceCertificate findValue="CN = srv-erp"/>

还有这个

<serviceCertificate findValue="CN = srv-erp"
                                storeLocation="LocalMachine"
                                x509FindType="FindBySubjectName"
                                storeName="My"/>

我也使用了 FindBySerialNumber。

但他们没有工作,我得到了这个错误

无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'、FindType 'FindBySubjectDistinguishedName'、FindValue 'CN = srv-erp'。

感谢您的帮助

【问题讨论】:

  • 打开mmc,为计算机账户添加证书管理单元,在个人节点检查你的证书是否安装。获取它的名称并尝试输入 findValue。
  • 我认为您不需要包含 cn=,只需将 srv-erp 添加为 findValue

标签: web-services wcf iis iis-7


【解决方案1】:

findValue 属性中的问题似乎尝试将其更改为 serv-erp。使用 x509FindType 时,不需要在 findValue 中放置属性键。

<serviceCertificate findValue="srv-erp"
                            storeLocation="LocalMachine"
                            x509FindType="FindBySubjectName"
                            storeName="My"/>

您也可以尝试通过其他类型 (see X509FindType reference) 查找您的证书,例如,通过指纹

<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" 
                            findValue="b5 ca b7 d0 b8 da fd 20 b7 bb 14 5d 66 2b 53 f3 0c 20 ca f2"/>

最后,确保您的证书存在。在 Search Windows 中键入 Run,然后复制并粘贴 certmgr.msc。然后在菜单上点击Action -> Find certificate...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    • 2018-12-12
    • 2010-10-10
    • 2011-10-25
    • 2011-07-03
    • 1970-01-01
    • 2011-05-26
    相关资源
    最近更新 更多