我正在尝试在 2x 64 位 Windows 机器之间建立基本的 .NET Remoting 通信。如果 Machine1 充当客户端,Machine2 充当服务器,那么一切正常。出现以下异常的另一种方式:
System.Net.Sockets.SocketException:无法建立连接,因为目标机器主动拒绝它 172.16.7.44:6666
服务器代码:
TcpChannel channel = new TcpChannel(6666);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(MyRemotableObject),"HelloWorld",WellKnownObjectMode.Singleton);
客户端代码:
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
// Create an instance of the remote object
remoteObject = (MyRemotableObject)Activator.GetObject(
typeof(MyRemotableObject), "tcp://172.16.7.44:6666/HelloWorld");
知道我的代码有什么问题吗?