I have a windows service which spawns a child process on the same machine. They communicate two way via TCP remoting. The child process has no problem pinging the parent, but ping calls from the parent's client to the child process's remote service never return.
Logs show the child process registers the server channel with the expected port and service name. However, I provide 127.0.0.1 as host, but when looking at the uri value in ChannelData I see the machine's actual ip address instead of the loopback address. Registering the child's server channel with this actual ip address instead of 127.0.0.1 makes no difference.
Netstat indicates that the expected port is listening:
TCP 0.0.0.0:23167 pc-name:0 LISTENING hostingProcId
TCP 0.0.0.0:23461 pc-name:0 LISTENING hostedProcId
The service is WellKnownObjectMode.Singleton. I don't know if the following info matters, but just in case, I do not override the marshallable object's InitializeLifetimeService.
adding secure=false to the cahnnel properties did not do the trick, and neither did explicitly setting in and out firewall rules on the relevant port.
I synchronize cross-process to ensure the client does not try to activate the remote object before the child process is fully set up.
Any ideas?
Client setup on the parent:
protected RemotingTcpClient(IpcUniplexConfig config)
{
Host = config.Host;
Port = config.Port;
ServiceName = config.ServiceName;
var props = new Hashtable();
props["name"] = ServiceName;
props["timeout"] = config.Timeout;
Channel = new TcpClientChannel(props, null);
ChannelServices.RegisterChannel(Channel, true);
var uri = string.Format("tcp://{0}:{1}/{2}", Host, Port, ServiceName);
Service = (TService)Activator.GetObject(typeof(TService), uri);
}
Client on the parent:
public IpcCallResponseData PingHostedProcess(int processId)
{
return Service.Ping(new IpcCallRequestData(processId));
}
Server setup on the child:
protected RemotingTcpServer(IpcUniplexConfig config, TService service, WellKnownObjectMode objectMode)
{
Port = config.Port;
Service = service;
var props = new Hashtable();
props["port"] = Port;
props["name"] = service.ServiceName;
Channel = new TcpServerChannel(props, null);
ChannelServices.RegisterChannel(Channel, true);
RemotingConfiguration.RegisterWellKnownServiceType(Service.GetType(), Service.ServiceName, objectMode);
}
Service on the child:
public IpcCallResponseData Ping(IpcCallRequestData data)
{
... some processing ...
return new IpcCallResponseData(_processId);
}