0
votes

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 :

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.

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

1

1 Answers

1
votes

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)