我希望能够从不同的服务器上从我的桌面连接到一个汇编中的函数。假设我在x.dll中有函数foo()。我想在服务器1上调用foo,然后在服务器2上调用foo等。我该怎么做?我更喜欢做远程处理。如果不可能,那么wcf。 我试图用远程处理。我首先在一台服务器上配置了它,当我尝试在另一台服务器上配置时,出现异常。 远程处理配置因异常'System.Runtime.Remoting.RemotingException:尝试重定向已重定向的类型'ControlServices.Controler,ControlServices'的激活而失败。在System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.AddActivatedClientType(ActivatedClientTypeEntry条目)在System.Runtime.Remoting.RemotingConfiguration.RegisterActivatedClientType(ActivatedClientTypeEntry条目)在System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.StoreRemoteAppEntries(RemotingXmlConfigFileData configData)在System.Runtime .Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData,Boolean ensureSecurity)'。 这是我的代码。我得到RegisterActivatedClientType错误 TcpChannel channel = new 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");
请*至少*注意格式化您的问题,以便它的可读性。 –