none
The caller was not authenticated by the service. RRS feed

  • Question

  • hi

    i create s wcf service with certificate

    web config server :

     <bindings>
          <wsHttpBinding>
            <binding name="wsHttpEndpointBinding">
              <security >
                <message clientCredentialType="Certificate" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
    
      <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    
     <behaviors>
          <serviceBehaviors>
            <behavior name="Service.erviceBehavior">
              <serviceMetadata httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
              <serviceCredentials>
                <clientCertificate>
                  <authentication certificateValidationMode="PeerTrust"/>
                </clientCertificate>
                <serviceCertificate findValue="WcfService" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
              </serviceCredentials>
            </behavior>
          </serviceBehaviors>
        </behaviors>

    web config Client :

      <bindings>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IService">
                        <security >
                            <message clientCredentialType="Certificate"  />
                        </security>
                    </binding>
                </wsHttpBinding>
            </bindings>
       <client>
                <endpoint address="http://localhost:8020/Service.svc"
                    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService"
                    contract="myServiceReference1.IService" name="WSHttpBinding_IService"
                    behaviorConfiguration="CustomBehavior" >
                    <identity>
                        <dns value="WcfServer" />
                    </identity>
                </endpoint>
            </client>
    
     <behaviors>
          <endpointBehaviors>
            <behavior name="CustomBehavior">
              <clientCredentials>
                <clientCertificate findValue="WcfServer" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
                <serviceCertificate>
                  <authentication certificateValidationMode="PeerTrust"/>
                </serviceCertificate>
              </clientCredentials>
            </behavior>
          </endpointBehaviors>
        </behaviors>

    but i  get this error :

    The caller was not authenticated by the service.

    please help me for resolve it

    it's urgent

    thanks

    Sunday, October 19, 2014 7:07 AM

Answers

  • Hi vahidbakhtiary,

    I see that your client endpoint address is http://localhost:8020/Service.svc, so please try to change the mexHttpsBinding to the mexHttpBinding as following:

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

    Since you met the error "the caller could not be authenticated by the service", it seems that you do not configure the certificate authentication very well. So please try to check the following articles to see if you have done something wrong:
    #WCF message security and client certificate authentication:
    http://robbincremers.me/2011/12/29/wcf-message-security-and-client-certificate-authentication-with-self-signed-certificates/ .

    #Nine simple steps to enable X.509 certificates on WCF:
    http://www.codeproject.com/Articles/36683/simple-steps-to-enable-X-certificates-on-WCF .

    Best Regards,
    Amy Peng

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 20, 2014 10:26 AM
    Moderator