【问题标题】:WCF Error "Found multiple X.509 certificates using search criteria"WCF 错误“使用搜索条件找到多个 X.509 证书”
【发布时间】:2014-01-03 17:20:04
【问题描述】:

当我尝试访问托管在我们暂存服务器上的 WCF 服务时收到以下错误。

“使用以下搜索条件找到多个 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'、FindType 'FindBySubjectName'、FindValue 'StagingServer001'。提供更具体的查找值。”

我尝试访问以下 URL 并出现上述错误:

http://stagingserver001/MyService1.svc

谁能指导我如何在商店中找到证书以删除它?或者我需要对 WCF 的配置进行哪些更改

请在下面找到取自 WCF 服务的 web.config 的相关代码

<behaviors>
      <endpointBehaviors>
        <behavior name="endpointCredentialBehavior">
          <clientCredentials>
            <clientCertificate findValue="SPLEBUSSTG02" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
            <serviceCertificate>
              <defaultCertificate findValue="772f3fdf2496c9750be3b0713003b47b15dfde96" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="SecurityBehavior">
          <serviceMetadata httpGetEnabled="True"  />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceCredentials>
            <serviceCertificate findValue="772f3fdf2496c9750be3b0713003b47b15dfde96" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
            <clientCertificate>
              <certificate findValue="SPLEBUSSTG02" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
              <authentication certificateValidationMode="PeerOrChainTrust" />
            </clientCertificate>
          </serviceCredentials>
        </behavior>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
          <ServiceErrorHandler />
        </behavior>
      </serviceBehaviors>

    </behaviors>

【问题讨论】:

  • 请不要张贴代码和配置文件的屏幕截图——这会让阅读变得非常困难。将代码或配置文件粘贴到您的问题中。
  • 完成,用代码替换截图

标签: .net wcf web-config soa client-certificates


【解决方案1】:

我认为您在证书存储中存在问题。请执行以下操作:

  1. 运行 mmc
  2. 菜单文件/添加删除管理单元
  3. 从树形视图中选择证书,而不是选择单选框本地计算机
  4. 证书(本地计算机)/个人/证书
  5. 查看列出的所有证书。应该有一个副本。 (如果第一眼看不到重复项,请双击每个证书,转到 Detatis 选项卡,找到 Subject 属性)

尽可能消除重复。在其他情况下,在您的配置中定义 FindByThumbprint 标准

【讨论】:

  • 我遇到了同样的问题。找到我的副本,将其删除,但仍然收到相同的错误消息。是否进行了 IISReset,重新启动了服务器,清除了服务器和本地计算机上的所有缓存。没有。众所周知,证书已经消失,但 IIS 仍然以某种方式“找到”它,
  • 我仍然建议使用 FindByThumbprint 选项和正确的证书 ID
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-03
  • 2018-12-12
  • 2012-07-14
  • 2020-03-04
  • 2010-10-10
  • 1970-01-01
相关资源
最近更新 更多