1

I have developed WCF windows service using net tcp binding. Its working fine when wcf client and wcf service both on the same system.

Getting error when both system are in work group not - Client and Service are on different machines

please suggest what configuration i need to change .

SocketId:61017335 to remote address :8005 had a connection reset error.

Error :System.ServiceModel.CommunicationException: 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 '00:00:58.9879193'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

I am using Certificate authentication - I know without a domain I lack the necessary Kerberos infrastuture to authenticate UPNs and SPNs but shouldn't that be resolved because I am using certificates.

Client’s Config File

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <client>
      <endpoint kind="discoveryEndpoint" address="net.tcp://localhost:8005/Probe" binding="netTcpBinding" bindingConfiguration="RequestReplyNetTcpBinding">
      </endpoint>
      <endpoint binding="netTcpBinding" bindingConfiguration="RequestReplyNetTcpBinding" contract="Test2ServLib.IService1" behaviorConfiguration="LargeEndpointBehavior">
        <identity>  
          <dns value="WCFServer" />  
        </identity>  
      <!--The behaviorConfiguration is required to enable WCF deserialization of large data sets -->
      </endpoint>
    </client>
 <behaviors>
      <endpointBehaviors>
        <behavior name="disableEndpointDiscovery">
          <endpointDiscovery enabled="false" />
          <!--The behavior is required to enable WCF deserialization of large data sets -->
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <clientCredentials>
            <clientCertificate findValue="WCFClient"
                               storeLocation="LocalMachine"
                               storeName="TrustedPeople"
                               x509FindType="FindBySubjectName" />
                        <serviceCertificate >  
                            <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
                        </serviceCertificate> 
          </clientCredentials>
        </behavior>
        <behavior name="LargeEndpointBehavior">
          <!--The behavior is required to enable WCF deserialization of large data sets -->
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            <clientCredentials>
              <clientCertificate findValue="WCFClient"
                                 storeLocation="LocalMachine"
                                 storeName="TrustedPeople"
                                 x509FindType="FindBySubjectName" />
                        <serviceCertificate >  
                            <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
                        </serviceCertificate> 
            </clientCredentials>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="RequestReplyNetTcpBinding" receiveTimeout="05:00:00" openTimeout="00:00:59" closeTimeout="00:00:59" maxBufferPoolSize="524288" maxBufferSize="25000000" maxConnections="50" maxReceivedMessageSize="25000000" sendTimeout="00:05:00" listenBacklog="1500">
          <reliableSession ordered="false" inactivityTimeout="00:01:00" enabled="true" />
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security>
            <message clientCredentialType="Certificate"/>
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Service Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="announcementBehavior">
      <!--The following behavior attribute is required to enable WCF serialization of large data sets -->
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      <serviceDiscovery>
        <announcementEndpoints>
          <endpoint kind="announcementEndpoint"
        address="net.tcp://localhost:8005/Announcement"
        binding="netTcpBinding"
        bindingConfiguration="RequestReplyNetTcpBinding"/>
        </announcementEndpoints>
      </serviceDiscovery>
      <serviceThrottling
              maxConcurrentCalls="1500"
              maxConcurrentSessions="1500"
              maxConcurrentInstances="1500"/>
      <serviceCredentials>
        <serviceCertificate findValue="WCFServer"
                            storeLocation="LocalMachine"
                            storeName="TrustedPeople"
                            x509FindType="FindBySubjectName" />
        <clientCertificate>
          <authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine" revocationMode="NoCheck"/>
        </clientCertificate>
      </serviceCredentials>
    </behavior>
 </serviceBehaviors>  
 </behaviors> 
 <service name="Test2ServLib.IService1"
   behaviorConfiguration="announcementBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8006/Service1"/>
      </baseAddresses>
    </host>
    <endpoint binding="netTcpBinding"
              bindingConfiguration="RequestReplyNetTcpBinding"
              contract="Test2ServLib.IService1"
              behaviorConfiguration="LargeEndpointBehavior" />
        <bindings>  
            <netTcpBinding>  
                <binding name = "RequestReplyNetTcpBinding">  
                    <security>  
                        <message clientCredentialType="Certificate" />  
                    </security>  
                </binding>  
            </netTcpBinding>  
        </bindings>  
  </system.serviceModel>
</configuration>
user173092
  • 127
  • 1
  • 1
  • 9
  • Please share service and client configuration – Menahem Sep 01 '20 at 19:46
  • Added the service and client configurations – user173092 Sep 01 '20 at 20:08
  • Hi,I replied to you in your previous post. I am sorry that I did not help you to solve this problem. I tried to use the information you provided to reproduce your problem but did not succeed. I did not encounter the problem you mentioned. I think this may be caused by the inconsistent TLS version. You try to make the client's .net framework version consistent with the server's .net framework version to see if the problem can be solved. – Ding Peng Sep 02 '20 at 06:51
  • My client and server use the .net framework 4.7.2, and the operating system is windows 10. – Ding Peng Sep 02 '20 at 06:53
  • can you please turn on WCF tracing on the service side, so that we can see why the service is rejecting the call ? [this can help with turning on tracing](https://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing) – Menahem Sep 02 '20 at 07:15
  • both client and server use .net framework 4.6.1. I did turn on the WCF tracing and errors are posted above – user173092 Sep 02 '20 at 13:19
  • Try to use the two solutions below:1)Update the certificate to not use the MD5 algorithm. This is the recommended solution.2)Need to change the configuration file to force the use of the protocol TLS 1.1. – Ding Peng Sep 16 '20 at 01:35
  • The signature algorithm is sha256RSA and signature hash is sha256. Also adding sslProtocols is not a valid attribute – user173092 Sep 17 '20 at 14:36
  • How long did the error occur? About this error may have nothing to do with WCF, it is more like a network problem, you can refer to this link for similar problems: https://answers.microsoft.com/en-us/edge/forum/edge_other-edge_ios/connection-reset-error/20f30104-4c56-4e8e-a190-46a3dc838396 – Ding Peng Sep 25 '20 at 05:35

0 Answers0