0

I have a service configuration as following:

<system.serviceModel>
    <client/>

    <services>
      <service name="MaxClientWcfService.ClientService" behaviorConfiguration="ServiceBehaviour">
        <endpoint name="testbasicEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="myBasicBinding" contract="MaxClientWcfService.IClientService"/>
    </services>

    <bindings>
      <basicHttpBinding>
        <binding name="myBasicBinding" closeTimeout="01:50:00" openTimeout="01:50:00" receiveTimeout="01:50:00" sendTimeout="01:50:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            <security mode="Transport">
          <transport clientCredentialType="Certificate"></transport>
            </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"/>
          <dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646"/>
        </behavior>
        <behavior name="ServiceBehaviourForIIS">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"/>
          <dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646"/>
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>

My Client configuration is like:

<bindings>
  <netTcpBinding>
    <binding name="netTcpBinding" closeTimeout="01:50:00" openTimeout="01:50:00"
      receiveTimeout="01:50:00" sendTimeout="01:50:00" maxReceivedMessageSize="2147483647">
      <reliableSession inactivityTimeout="00:10:00" enabled="true" />
    </binding>
  </netTcpBinding>
</bindings>

<client>
  <endpoint address="net.tcp://127.0.0.1:1451/CardProWCFService"
    binding="netTcpBinding" bindingConfiguration="netTcpBinding"
    contract="HostService.ICardProWCFService" name="netTcpBinding" />
  <endpoint address="https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc"
    binding="basicHttpsBinding" bindingConfiguration="testbasicEndpoint"
    contract="MAXServiceReferenceClient.IClientService" name="testbasicEndpoint" behaviorConfiguration="endpointCredentialBehavior" />
</client>

<behaviors>  
    <endpointBehaviors>  
    <behavior name="endpointCredentialBehavior">  
      <clientCredentials>  
        <clientCertificate findValue="XXXXXXXXXXXXXXXXXXXXXX"  
                           storeLocation="LocalMachine"  
                           storeName="My"  
                           x509FindType="FindByThumbprint" /> 
        <serviceCertificate >  
            <authentication certificateValidationMode="PeerTrust"/>  
        </serviceCertificate> 
      </clientCredentials>  
    </behavior>  
  </endpointBehaviors> 
</behaviors> 

When i test this one over the Visual Studio WCF Test Client, I am getting following error:

Error: Cannot obtain Metadata from https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc Metadata contains a reference that cannot be resolved: 'https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc'. Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:9090'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.HTTP GET Error URI: https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc There was an error downloading 'https://localhost:9090/MAXxEMVIISSAAS_11June2020/maxclientservice/ClientService.svc'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.**

Please I will be thankful for any help!

Corentin Pane
  • 4,794
  • 1
  • 12
  • 29
Maestro00
  • 21
  • 9
  • 1
    `The remote certificate is invalid according to the validation procedure` -- That's where I would start my troubleshooting. – Robert Harvey Jun 12 '20 at 15:34
  • @RobertHarvey I generated a self signed certificate on the IIS and imported that certificate under the Trusted Root Authority. Do i need to configure anything else to over the configurations? Thanks – Maestro00 Jun 12 '20 at 15:50
  • Have a look here: https://stackoverflow.com/q/4977218 – Robert Harvey Jun 12 '20 at 15:52
  • The most likely issue is with LocalHost Try IP of machine or Machine name. The LocalHost is not configured the same on all machines. Also check the Service is running. From cmd.exe >Netstat -a which will indicate if there is a listener on machine for the port 9090. For code to work it looks like the folder MAXxEMVIISSAAS_11June2020 must be shared. – jdweng Jun 12 '20 at 16:20
  • @jdweng Thanks for comment. I have tried with IP and didn't work. IIS is working in my local and I am trying to bind from my local as well. So Why would i need to share the folder? – Maestro00 Jun 12 '20 at 16:29
  • Because you are using https://localhost:9090/MAXxEm........ You are going out on the Network and then coming back into the PC. The folder has to bee seen from the Network. – jdweng Jun 12 '20 at 16:44
  • I get your point and now I have shared the folder with everyone which is in my network. But still once try to connect i am getting the same error. Any other suggestion please? Thanks in advance – Maestro00 Jun 12 '20 at 16:57
  • Whether the client does not trust the self signed certificate? I think you need to let the client trust your server certificate. – Ding Peng Jun 18 '20 at 02:01

0 Answers0