Issue when implementing TLS for net.tcp endpoint in existing WCF service. The socket connection was aborted

51 views Asked by At

I'm currently working on enabling certificate authentication for an existing net.tcp endpoint and am receiving the error:

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '01:00:00'.

I've tried multiple different configuration options, one of which is shown below.

The certificate is installed on both server and client machines, the endpoint exists and port is open - I'm just adding the certificate exchange to the message.

Hoping someone can point me in the right direction.

Client:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="NetTcpBinding_ImyService">
                <security mode="Transport">
                    <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
                </security>
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="net.tcp://machine.domain:2790/IPC.myService.svc"
            binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ImyService"
            contract="IPC.ImyService" name="NetTcpBinding_ImyService" behaviorConfiguration="CustomBehavior">
        </endpoint>
    </client>
    <behaviors>
        <endpointBehaviors>
            <behavior name="CustomBehavior">
               <clientCredentials>
                   <clientCertificate findValue="certificateFingerPrint1234abc" x509FindType="FindByThumbprint"
                          storeLocation="LocalMachine" storeName="My" />
                   </clientCredentials>
            </behavior>
        </endpointBehaviors>
    </behaviors>
</system.serviceModel>

Server:

<system.serviceModel>
  <services>
      <service name="nettcp_IPC.myService" behaviorConfiguration="nettcp_IPC.myServiceBehavior">
          <endpoint 
              address="" 
              binding="netTcpBinding" bindingConfiguration="nettcp_IPC.myServiceBinding"
              contract="IPC.ImyService" />
          <endpoint
              address="mex" 
              binding="mexTcpBinding" 
              contract="IMetadataExchange" />
          <host>
              <baseAddresses>
                  <add baseAddress="net.tcp://machine.domain:2790/IPC.myService.svc"/>
              </baseAddresses>
          </host>
      </service>
  </services>
  <bindings>
      <netTcpBinding>
          <binding name="nettcp_IPC.myServiceBinding"
                   receiveTimeout="00:15:00" 
                   sendTimeout="00:15:00" 
                   maxBufferPoolSize="2147483647" 
                   maxReceivedMessageSize="2147483647">
                  <security mode="Transport">
                      <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign"/>
                  </security>
          </binding>
    </netTcpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior name="nettcp_IPC.myServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>
0

There are 0 answers