C# 在webservice中找不到使用以下搜索条件的证书

C# 在webservice中找不到使用以下搜索条件的证书,c#,asp.net,.net,web-services,C#,Asp.net,.net,Web Services,我正在尝试使用Asp.net。他们在地址中有一个Web服务。 通过服务引用添加后,运行以下代码: ServiceReferenceAdvCash1.MerchantWebServiceClient Adv_Api = new ServiceReferenceAdvCash1.MerchantWebServiceClient(); ServiceReferenceAdvCash1.walletBalanceDTO[] Balances = Adv_Api.getBalan

我正在尝试使用Asp.net。他们在地址中有一个Web服务。 通过服务引用添加后,运行以下代码:

 ServiceReferenceAdvCash1.MerchantWebServiceClient Adv_Api = new ServiceReferenceAdvCash1.MerchantWebServiceClient();
            ServiceReferenceAdvCash1.walletBalanceDTO[] Balances = Adv_Api.getBalances(new ServiceReferenceAdvCash1.authDTO() { apiName = apiName, accountEmail = accountEmail, authenticationToken = token });
但它导致了错误:

未提供客户端证书。在ClientCredentials中指定客户端证书

因此,我在web.config中指定了clientCertificate:

 <bindings>
  <basicHttpBinding>
    <binding name="MerchantWebServiceSoapBinding">
      <security mode="Transport" >
        <transport clientCredentialType="Certificate"/>
      </security>
    </binding>
    <binding name="MerchantWebServiceSoapBinding1" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="https://wallet.advcash.com/wsm/merchantWebService"
    binding="basicHttpBinding" bindingConfiguration="MerchantWebServiceSoapBinding"
    contract="ServiceReferenceAdvCash1.MerchantWebService" name="MerchantWebServicePort" behaviorConfiguration="endpointBehavior" />
</client>
<behaviors>
  <endpointBehaviors>
    <behavior name="endpointBehavior">
      <clientCredentials>
        <clientCertificate storeLocation="LocalMachine" storeName="My" findValue="ClientSide" x509FindType="FindBySubjectName"/>
        <serviceCertificate>
          <authentication certificateValidationMode="None" revocationMode="NoCheck" />
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors> 

但它仍然会出错:

使用以下搜索条件找不到X.509证书:StoreName“My”、StoreLocation“LocalMachine”、FindType“FindBySubjectName”、FindValue“ClientSide”


我应该向服务器添加任何证书吗?或者有其他解决方案吗?

运行代码的机器,如果您运行的是Windows wnd+R类型MMC enter,然后查找选择证书本地机器,在个人或受信任证书下,您需要能够看到“客户端”证书主题证书我在MMC中找不到“客户端”证书,我可以添加证书吗?如果它不在任何一个文件夹中,那么您需要添加它感谢您的回复,我正在尝试添加它,但我为什么要这样做?我的意思是我以前使用过很多API,但我从未遇到过这样的问题。“客户端”证书是通用的还是为服务指定的?我应该获取AdvCash证书并将其添加到我的服务器吗?