Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed WCF windows service using net tcp binding. Its working fine when wcf client and wcf service both are in domain (in two different system)

Getting error when both system are in work group not in domain
please suggest what configuration i need to change.

Quote:
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:29:59.9687496'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

I am using Certificate authentication and Message instead of Transport

Client
XML
<?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
<?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>


What I have tried:

Increasing the timeouts, setting security mode to none
Looked at these similar discussion for configuration settings:
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 | www.code-geek.com
WCF Windows Service Using NetTCPbinding
net.tcp wcf service (windows service hosted) in domain server and client outside of domain - Stack Overflow
Socket Exception - WCF
Posted
Updated 21-Sep-20 6:22am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900