Chris
Chris

Reputation: 27394

The service certificate is not provided for target '###' Specify a service certificate in ClientCredentials

I have implemented a test Client / Server that implements UserName message authentication over WCF. It almost all works however I have fallen at the last hurdle.

I get an InvalidOperationException that reads

The service certificate is not provided for target 'http://localhost:8732/Design_Time_Addresses/EvalServiceLibrary/Service1/'. Specify a service certificate in ClientCredentials.

Can anyone shed any light?

Thanks

Upvotes: 2

Views: 7894

Answers (3)

BornToCode
BornToCode

Reputation: 10213

Include something like this in your client configuration file:

<client>
 <endpoint address="http://example.com/Myservice.svc"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService"
        contract="Core.IService" name="WSHttpBinding_IService" behaviorConfiguration="myServiceBehaviour" >
   <identity>
    <dns value="SampleServiceCertificate"/>
   </identity>
 </endpoint>
</client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="myServiceBehaviour">
          <clientCredentials>
            <serviceCertificate>
              <defaultCertificate storeLocation="LocalMachine" storeName="My" findValue="SampleServiceCertificate" x509FindType="FindBySubjectName"  />
            </serviceCertificate>
          </clientCredentials>
        </behavior>            
      </endpointBehaviors>          
    </behaviors>

Upvotes: 2

Chris Dickson
Chris Dickson

Reputation: 12135

Your client needs to be able to authenticate the service by reference to an X509certificate, the public key of which it will use to encrypt messages sent to the service.

The service certificate is identified on the client side by the ServiceCertificate property of the ClientCredentials. The error message is telling you that your configuration/code hasn't set this up correctly. If you post your code/config we may be able to tell you what's wrong.

Upvotes: 0

Gary L Cox Jr
Gary L Cox Jr

Reputation: 690

Sounds like your requiring a certificate for security and your client code is not supplying the certificate on request. WCF Security

Upvotes: 1

Related Questions