コード例 #1
0
        // Initialise the remoting connection with http channel with binary formatter
        public bool RemotingConnection()
        {
            if (!_exist)
            {
                HttpChannel channel = null;
                try
                {
                    IDictionary props = new Hashtable();
                    props["port"] = TechnicalSettings.RemotingServerPort;
                    props.Add("typeFilterLevel", TypeFilterLevel.Full);
                    //props.Add("timeout", 2000);
                    BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
                    channel = new HttpChannel(props, clientProvider, null);
                    ChannelServices.RegisterChannel(channel, false);

                    //TcpChannel channel = new TcpChannel();
                    //ChannelServices.RegisterChannel(channel, true);
                    var server = string.Format("http://{0}:{1}/RemoteOperation", TechnicalSettings.RemotingServer,
                                               TechnicalSettings.RemotingServerPort);

                    _remoteOperation = (IRemoteOperation)Activator.GetObject(typeof(IRemoteOperation), server);
                    _exist           = _remoteOperation.TestRemoting();

                    //ChannelServices.GetChannelSinkProperties(_remoteOperation)["timeout"] = 0;
                }
                catch (Exception e)
                {
                    _remotingUniqueInstance = null;
                    ChannelServices.UnregisterChannel(channel);
                    throw;
                }
            }
            return(true);
        }
コード例 #2
0
 public static Remoting GetInstance()
 {
     if (_remotingUniqueInstance == null)
     {
         return(_remotingUniqueInstance = new Remoting());
     }
     else
     {
         return(_remotingUniqueInstance);
     }
 }
コード例 #3
0
 private ServicesProvider()
 {
     if (TechnicalSettings.UseOnlineMode)
     {
         _iServices = Remoting.GetInstance();
     }
     else
     {
         _iServices = new Standard();
     }
 }
コード例 #4
0
ファイル: Remoting.cs プロジェクト: TalasZh/opencbs
        // Initialise the remoting connection with http channel with binary formatter
        public bool RemotingConnection()
        {
            if (!_exist)
            {

                HttpChannel channel = null;
                try
                {
                    IDictionary props = new Hashtable();
                    props["port"] = TechnicalSettings.RemotingServerPort;
                    props.Add("typeFilterLevel", TypeFilterLevel.Full);
                    //props.Add("timeout", 2000);
                    BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
                    channel = new HttpChannel(props, clientProvider, null);
                    ChannelServices.RegisterChannel(channel, false);

                    //TcpChannel channel = new TcpChannel();
                    //ChannelServices.RegisterChannel(channel, true);
                    var server = string.Format("http://{0}:{1}/RemoteOperation", TechnicalSettings.RemotingServer,
                                               TechnicalSettings.RemotingServerPort);

                    _remoteOperation = (IRemoteOperation) Activator.GetObject(typeof (IRemoteOperation), server);
                    _exist = _remoteOperation.TestRemoting();

                    //ChannelServices.GetChannelSinkProperties(_remoteOperation)["timeout"] = 0;
                }
                catch(Exception e)
                {
                    _remotingUniqueInstance = null;
                    ChannelServices.UnregisterChannel(channel);
                    throw;
                }
            }
            return true;
        }
コード例 #5
0
ファイル: Remoting.cs プロジェクト: TalasZh/opencbs
 public static Remoting GetInstance()
 {
     if (_remotingUniqueInstance == null)
         return _remotingUniqueInstance = new Remoting();
     else
         return _remotingUniqueInstance;
 }