WCF错误"使用搜索条件找到多个X.509证书"

Nir*_*man 5 .net wcf soa web-config client-certificates

我尝试访问登台服务器上托管的WCF服务时收到以下错误.

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

我尝试访问以下URL并获得以上错误:

http://stagingserver001/MyService1.svc
Run Code Online (Sandbox Code Playgroud)

任何人都可以指导我如何在商店中找到证书删除它?或者我在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>
Run Code Online (Sandbox Code Playgroud)

Yau*_*sau 14

我认为你在证书商店有问题.请执行以下操作:

  1. 运行mmc
  2. 菜单文件/添加删除管理单元
  3. 从树视图中选择证书,比选择radiobox本地计算机
  4. 证书(本地计算机)/个人/证书
  5. 查看那里列出的所有证书.应该有一个出版物.(如果第一次看不到复制,双击每个证书,转到Detatis选项卡,找到Subject属性) 在此输入图像描述

如果可能的话,摆脱重复.在其他情况下,在配置中定义FindByThumbprint条件