![](/img/trans.png)
[英].NET Remoting: how to access server application objects from remotable object?
[英]How to access remote object from other computer in remoting
我有一个服务器对象
TcpChannel tcp = new TcpChannel(1234);
ChannelServices.RegisterChannel(tcp, false);
string s = ConfigurationManager.AppSettings["remote"];
RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestRemoting.InitialClass1), "TestRemoting", WellKnownObjectMode.Singleton);
Console.WriteLine("Server is running on 1234 channel...");
Console.WriteLine("Press Enter to Stop");
Console.ReadLine();
我正在以mu客户端形式访问该对象
InitialClass1 Icls = (InitialClass1)Activator.GetObject(typeof(InitialClass1), "tcp://localhost:1234//TestRemoting");
现在,我将远程对象保留在另一台计算机中。 如何从那台计算机访问服务器对象。 如果我从本地计算机访问服务器对象,则将使用
"tcp://localhost:1234//TestRemoting"
我在这里使用本地主机 ,因为我的服务器对象和客户端是相同的。 因此,如果这两个不同,则如何访问服务器对象。 我尝试使用另一台计算机IP作为
tcp://200.100.0.52:1234//TestRemoting
那个时候我得到一个例外
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 200.100.0.52:1234
该消息表示大多数情况下客户端找不到服务。 您可以使用以下步骤确定连接失败的位置:
失败的步骤表明失败的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.