本文介绍了无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所见,我使用此配置创建了一个带有身份验证方法的简单 wcf 项目:

I create a simple wcf project with authentication method with this config as you can see :

        <serviceCertificate findValue="STSTestCert"
                            storeLocation="LocalMachine"
                            x509FindType="FindBySubjectName"
                            storeName="My"/>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

但是当我运行该项目时出现此错误:

but when i run the project i get this error :

无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'、FindType 'FindBySubjectName'、FindValue 'STSTestCert'.说明:在执行当前 Web 请求期间发生未处理的异常.请查看堆栈跟踪以了解有关错误及其在代码中的来源的更多信息.

Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue 'STSTestCert'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.InvalidOperationException:无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'、FindType 'FindBySubjectName'、FindValue 'STSTestCert'.

Exception Details: System.InvalidOperationException: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindBySubjectName', FindValue 'STSTestCert'.

推荐答案

您确定证书已安装?例如,如果您在 PowerShell dir cert:\LocalMachine\My 中尝试,您是否在那里找到证书 STSTestCert?如果没有,那么您可能将它安装在其他地方.也许当你安装它时你没有明确指定 Personal 文件夹(因为这是 My 在这里的意思)

Are you sure the certificate is installed? Example, if you try in PowerShell dir cert:\LocalMachine\My, do you find the certificate STSTestCert there? If not then you probably installed it somewhere else. Perhaps when you've installed it you have not explicitly specified the Personal folder (because this is what My means here)

这篇关于无法使用以下搜索条件找到 X.509 证书:StoreName 'My'、StoreLocation 'LocalMachine'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 18:24