Search code examples
.net-remoting

Client-side activation doesn't work over the network while server-side activation works


I play with .Net Remoting. Simple apps pair with server-side activation works fine over the local network. But the same apps don't work when I change the activation mode to client-side. For sure it works locally. Firewalls are disabled. The error message: "System.Net.Sockets.SocketException: 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ipaddress:8989'".

Further investigation showed what the remote object created successfully; the error appears when client runs a method.

Machine names are defined in 'hosts' files, permanent IP addresses are in use.

What can be a reason?

Server config - server-side activation

<configuration>
  <system.runtime.remoting>
    <application>
      <service>
        <wellknown mode="Singleton" type="MathLibrary.MathLibrary, MathLibrary" objectUri="MathLibrary"/>
      </service>
      <channels>
        <channel ref="tcp" port="8989" />
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

Server config - client-side activation

<configuration>
  <system.runtime.remoting>
    <application>
      <service>
        <activated type="MathLibrary.MathLibrary, MathLibrary"/>
      </service>
      <channels>
        <channel ref="tcp" port="8989" />
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

Client config - server-side activation

<configuration>
  <system.runtime.remoting>
    <application>
      <client>
        <wellknown type="MathLibrary.MathLibrary, MathLibrary"  url="tcp://machinename:8989/MathLibrary" />
      </client>
    </application>
  </system.runtime.remoting>
</configuration>

Client config - client-side activation

<configuration>
  <system.runtime.remoting>
    <application>
      <client url="tcp://machinename:8989">
        <activated type="MathLibrary.MathLibrary, MathLibrary" />
      </client>
    </application>
  </system.runtime.remoting>
</configuration>

Solution

  • Finally, it was caused by the number of NICs on the server machine. After some manipulation with networks, IP addresses, IP protocol metrics it started to work. Moreover, disabling extra NICs didn't help during troubleshooting.

    Evidently, if multiple NICs are available, it's necessary to bind the channel to the specific NIC by its IP address or apply other solutions. Going to investigate it after.