【发布时间】:2016-09-07 10:23:39
【问题描述】:
我希望能够从不同服务器上的桌面连接到程序集中的函数。假设我在 x.dll 中有函数 foo()。我想在服务器 1 上调用 foo,然后在服务器 2 上调用 foo 等。我该怎么做?我更喜欢做远程处理。如果不可能,那么 wcf. 我尝试通过远程处理来做到这一点。我首先在一台服务器上配置它,当我尝试在另一台服务器上配置时出现异常。 远程配置失败,出现异常“System.Runtime.Remoting.RemotingException:尝试重定向已重定向的“ControlServices.Controler,ControlServices”类型的激活。在 System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.AddActivatedClientType(ActivatedClientTypeEntry entry) 在 System.Runtime.Remoting.RemotingConfiguration.RegisterActivatedClientType(ActivatedClientTypeEntry entry) 在 System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.StoreRemoteAppEntries(RemotingXmlConfigFileData configData) 在 System.Runtime .Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData, Boolean ensureSecurity)'。 这是我的代码。我在 RegisterActivatedClientType 上收到错误 TcpChannel 频道 = 新 TcpChannel(); ChannelServices.RegisterChannel(channel, true);
ActivatedClientTypeEntry remotetype = new ActivatedClientTypeEntry(
typeof(Controler),
"tcp://172.22.110.25:8086");
RemotingConfiguration.RegisterActivatedClientType(remotetype);
Controler control = new Controler();
string str = control.ServiceState("SchedulerServiceIT");
channel.StopListening(null);
//RemotingServices.Disconnect(control);
ChannelServices.UnregisterChannel(channel);
channel = null;
channel = new TcpChannel();
ChannelServices.RegisterChannel(channel, true);
remotetype = new ActivatedClientTypeEntry(
typeof(Controler),
"tcp://172.22.110.25:8086");
RemotingConfiguration.RegisterActivatedClientType(remotetype);
control = new Controler();
str = control.ServiceState("SchedulerServiceIT");
【问题讨论】:
-
请至少注意格式化您的问题,使其可读。