2016-09-07 73 views
-1

我希望能夠從不同的服務器上從我的桌面連接到一個彙編中的函數。假設我在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"); 
+0

請*至少*注意格式化您的問題,以便它的可讀性。 –

回答