コード例 #1
0
        /// <summary>
        /// Creates and configures a Remoting channel.
        /// </summary>
        /// <returns>Remoting channel</returns>
        public override IChannel CreateChannel()
        {
            IChannel channel = ChannelServices.GetChannel(_channelName);

            if (channel == null)
            {
                _channelSettings["name"]   = _channelName;
                _channelSettings["port"]   = _httpPort;
                _channelSettings["bindTo"] = _ipAddress;
                _channelSettings["secure"] = false;

                ConfigureEncryption();
                ConfigureCompression();

                if (_channelFactory == null)
                {
                    throw new ApplicationException(LanguageResource.ApplicationException_NoChannelFactorySpecified);
                }

                channel = _channelFactory(_channelSettings, BuildClientSinkChain(), BuildServerSinkChain());
                RemotingHelper.ResetCustomErrorsMode();
            }

            return(channel);
        }
コード例 #2
0
 //este boton tiene la instancia que levanta el server
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         int puerto_server = Convert.ToInt32(tb_client_port.Text);
         if (Channel != null)
         {
         }
         else
         {
             Channel = new TcpChannel(puerto_server);
             if (ChannelServices.GetChannel(Channel.ChannelName) != null)
             {
             }
             else
             {
                 ChannelServices.RegisterChannel(Channel, false);
             }
         }
         RemotingConfiguration.RegisterWellKnownServiceType(
             typeof(Libreria.Class1), "chat",
             WellKnownObjectMode.Singleton);
         local                  = (Class1)Activator.GetObject(typeof(Class1), "tcp://localhost:" + tb_client_port.Text + "/chat");
         button1.Enabled        = false;
         tb_client_port.Enabled = false;
         // button2.Enabled = true;
         timer1.Start();
         MessageBox.Show("Servidor ha sido montado!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #3
0
        /// <summary>
        /// Get a channel by name, casting it to a TcpChannel.
        /// Otherwise, create, register and return a TcpChannel with
        /// that name, on the port provided as the second argument.
        /// </summary>
        /// <param name="name">The channel name</param>
        /// <param name="port">The port to use if the channel must be created</param>
        /// <param name="limit">The client connection limit or negative for the default</param>
        /// <returns>A TcpChannel or null</returns>
        public static TcpChannel GetTcpChannel(string name, int port, int limit)
        {
            TcpChannel channel = ChannelServices.GetChannel(name) as TcpChannel;

            if (channel == null)
            {
                // NOTE: Retries are normally only needed when rapidly creating
                // and destroying channels, as in running the NUnit tests.
                int retries = 10;
                while (--retries > 0)
                {
                    try
                    {
                        channel = CreateTcpChannel(name, port, limit);
#if CLR_2_0 || CLR_4_0
                        ChannelServices.RegisterChannel(channel, false);
#else
                        ChannelServices.RegisterChannel(channel, false);
#endif
                        break;
                    }
                    catch (Exception e)
                    {
                        System.Threading.Thread.Sleep(300);
                    }
                }
            }

            return(channel);
        }
コード例 #4
0
        string RegisterRemotingChannel()
        {
            if (remotingChannel == "tcp")
            {
                IChannel ch = ChannelServices.GetChannel("tcp");
                if (ch == null)
                {
                    IDictionary dict = new Hashtable();
                    BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
                    BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();

                    dict["port"] = 0;
                    serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

                    ChannelServices.RegisterChannel(new TcpChannel(dict, clientProvider, serverProvider), false);
                }
            }
            else
            {
                IChannel ch = ChannelServices.GetChannel("unix");
                if (ch == null)
                {
                    unixRemotingFile = Path.GetTempFileName();
                    ChannelServices.RegisterChannel(new UnixChannel(unixRemotingFile), false);
                }
            }
            return(remotingChannel);
        }
コード例 #5
0
        string RegisterRemotingChannel(IsolationMode mode)
        {
            string remotingChannel;

            if (mode == IsolationMode.ProcessTcp)
            {
                remotingChannel = "tcp";
                IChannel ch = ChannelServices.GetChannel("tcp");
                if (ch == null)
                {
                    ChannelServices.RegisterChannel(new TcpChannel(0), false);
                }
            }
            else
            {
                remotingChannel = "unix";
                IChannel ch = ChannelServices.GetChannel("unix");
                if (ch == null)
                {
                    string unixRemotingFile = Path.GetTempFileName();
                    ChannelServices.RegisterChannel(new UnixChannel(unixRemotingFile), false);
                }
            }
            return(remotingChannel);
        }
コード例 #6
0
        /// <summary>
        /// Get a channel by name, casting it to a <see cref="TcpChannel"/>.
        /// Otherwise, create, register and return a <see cref="TcpChannel"/> with
        /// that name, on the port provided as the second argument.
        /// </summary>
        /// <param name="name">The name of the channel</param>
        /// <param name="port">The port to use if the channel must be created.</param>
        /// <param name="limit">The client connection limit or negative for the default.</param>
        /// <param name="currentMessageCounter">An optional counter to provide the ability to wait for all current messages.</param>
        /// <returns>The specified <see cref="TcpChannel"/> or <see langword="null"/> if it cannot be found and created.</returns>
        public static TcpChannel GetTcpChannel(string name, int port, int limit, CurrentMessageCounter currentMessageCounter = null)
        {
            var existingChannel = ChannelServices.GetChannel(name) as TcpChannel;

            if (existingChannel != null)
            {
                return(existingChannel);
            }

            // NOTE: Retries are normally only needed when rapidly creating
            // and destroying channels, as in running the NUnit tests.
            for (var retries = 0; retries < 10; retries++)
            {
                try
                {
                    var newChannel = CreateTcpChannel(name, port, limit, currentMessageCounter);
                    ChannelServices.RegisterChannel(newChannel, false);
                    return(newChannel);
                }
                catch (Exception ex)
                {
                    Log.Error("Failed to create/register channel", ex);
                    Thread.Sleep(300);
                }
            }

            return(null);
        }
コード例 #7
0
 private void btnjoin_Click(object sender, EventArgs e)
 {
     try
     {
         if (client_channel == null)
         {
             client_channel = new TcpChannel();
             ChannelServices.RegisterChannel(client_channel, false);
         }
         remota = (Class1)Activator.GetObject(typeof(Class1), tb_server_tcp_chan.Text);
         if (remota.its_in_tha_room(n_user.nickname, n_user.ip, n_user.port))
         {
             MessageBox.Show("El usuario ya esta en sala o nickname ya tomado.");
             if (ChannelServices.GetChannel(client_channel.ChannelName) != null)
             {
                 ChannelServices.UnregisterChannel(client_channel);
             }
         }
         else
         {
             remota.Subscribe(n_user.nickname, n_user.ip, n_user.port);
             MessageBox.Show("Te has unido a la sala");
             timer1.Start();
         }
     }
     catch (Exception ex)
     {
         if (ChannelServices.GetChannel(client_channel.ChannelName) != null)
         {
             ChannelServices.UnregisterChannel(client_channel);
         }
         MessageBox.Show("No se ha podido unir a la sala: " + ex.Message);
     }
 }
コード例 #8
0
        static void Main(string[] args)
        {
            try
            {
                String filename = "client.exe.config";
                RemotingConfiguration.Configure(filename);

                CustomerManager mgr = new CustomerManager();

                Console.WriteLine("Client.Main(): Reference to CustomerManager " +
                                  " acquired");

                IChannel chnl = ChannelServices.GetChannel("http");

                Object      obj   = ChannelServices.RegisteredChannels;
                IDictionary props = ChannelServices.GetChannelSinkProperties(mgr);
                props["username"]        = "******";
                props["password"]        = "******";
                props["preauthenticate"] = "True";

                Customer cust = mgr.getCustomer(4711);
                int      age  = cust.getAge();
                Console.WriteLine("Client.Main(): Customer {0} {1} is {2} years old.",
                                  cust.FirstName,
                                  cust.LastName,
                                  age);
            }
            catch (Exception e)
            {
                Console.WriteLine("EX: {0}", e.Message);
            }

            Console.ReadLine();
        }
コード例 #9
0
        /// <summary>
        /// Publish objects so that the host can use it, and then block indefinitely (until the input stream is open).
        ///
        /// Note that we should publish only one object, and then have other objects be accessible from it. Publishing
        /// multiple objects can cause problems if the client does a call like "remoteProxy1(remoteProxy2)" as remoting
        /// will not be able to know if the server object for both the proxies is on the same server.
        /// </summary>
        /// <param name="remoteRuntimeChannelName">The IPC channel that the remote console expects to use to communicate with the ScriptEngine</param>
        /// <param name="scope">A intialized ScriptScope that is ready to start processing script commands</param>
        internal static void StartServer(string remoteRuntimeChannelName, ScriptScope scope)
        {
            Debug.Assert(ChannelServices.GetChannel(remoteRuntimeChannelName) == null);

            IpcChannel channel = CreateChannel("ipc", remoteRuntimeChannelName);

            LifetimeServices.LeaseTime            = GetSevenDays();
            LifetimeServices.LeaseManagerPollTime = GetSevenDays();
            LifetimeServices.RenewOnCallTime      = GetSevenDays();
            LifetimeServices.SponsorshipTimeout   = GetSevenDays();

            ChannelServices.RegisterChannel(channel, false);

            try {
                RemoteCommandDispatcher remoteCommandDispatcher = new RemoteCommandDispatcher(scope);
                RemotingServices.Marshal(remoteCommandDispatcher, CommandDispatcherUri);

                // Let the remote console know that the startup output (if any) is complete. We use this instead of
                // a named event as we want all the startup output to reach the remote console before it proceeds.
                Console.WriteLine(RemoteCommandDispatcher.OutputCompleteMarker);

                // Block on Console.In. This is used to determine when the host process exits, since ReadLine will return null then.
                string input = System.Console.ReadLine();
                Debug.Assert(input == null);
            } finally {
                ChannelServices.UnregisterChannel(channel);
            }
        }
コード例 #10
0
        /// <summary>
        /// Creates and configures a Remoting channel.
        /// </summary>
        /// <returns>Remoting channel</returns>
        public override IChannel CreateChannel()
        {
            IChannel channel = ChannelServices.GetChannel(_channelName);

            if (channel == null)
            {
                _channelSettings["name"]               = _channelName;
                _channelSettings["port"]               = 0;
                _channelSettings["secure"]             = _useWindowsSecurity;
                _channelSettings["socketCacheTimeout"] = 0;
                _channelSettings["socketCachePolicy"]  = SocketCachingEnabled ? SocketCachePolicy.Default : SocketCachePolicy.AbsoluteTimeout;

                if (_useWindowsSecurity)
                {
                    _channelSettings["tokenImpersonationLevel"] = _impersonationLevel;
                    _channelSettings["protectionLevel"]         = _protectionLevel;
                }
                if (_channelFactory == null)
                {
                    throw new ApplicationException(LanguageResource.ApplicationException_NoChannelFactorySpecified);
                }

                channel = _channelFactory(_channelSettings, BuildClientSinkChain(), BuildServerSinkChain());
                RemotingHelper.ResetCustomErrorsMode();
            }

            return(channel);
        }
コード例 #11
0
        internal static IpcServerChannel IpcCreateServer <T>(string domain, string portName, WellKnownObjectMode mode, T obj) where T : MarshalByRefObject
        {
            IpcServerChannel channel = ChannelServices.GetChannel(domain) as IpcServerChannel;

            if (channel == null)
            {
                BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
                serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                //Instantiate our server channel.
                channel = new IpcServerChannel(domain, domain, serverProvider);
                //Register the server channel.
                ChannelServices.RegisterChannel(channel, false);
            }

            var c = channel.GetChannelUri();

            //Register this service type.
            if (obj == null)
            {
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(T), portName, mode);
            }
            else
            {
                RemotingServices.Marshal(obj, portName);
            }
            return(channel);
        }
コード例 #12
0
        /// <summary>
        /// Creates and configures a Remoting channel.
        /// </summary>
        /// <returns>Remoting channel</returns>
        public override IChannel CreateChannel()
        {
            IChannel channel = ChannelServices.GetChannel(_channelName);

            if (channel == null)
            {
                _channelSettings["name"]              = _channelName;
                _channelSettings["port"]              = 0;
                _channelSettings["listen"]            = false;
                _channelSettings["typeFilterLevel"]   = TypeFilterLevel.Full;
                _channelSettings["keepAliveEnabled"]  = _tcpKeepAliveEnabled;
                _channelSettings["keepAliveTime"]     = _tcpKeepAliveTime;
                _channelSettings["keepAliveInterval"] = _tcpKeepAliveInterval;

                ConfigureEncryption();
                ConfigureCompression();

                if (_channelFactory == null)
                {
                    throw new ApplicationException(LanguageResource.ApplicationException_NoChannelFactorySpecified);
                }

                channel = _channelFactory(_channelSettings, BuildClientSinkChain(), BuildServerSinkChain());
                RemotingHelper.ResetCustomErrorsMode();
            }

            return(channel);
        }
コード例 #13
0
        /// <summary>
        /// Creates and configures a Remoting channel.
        /// </summary>
        /// <returns>Remoting channel</returns>
        public override IChannel CreateChannel()
        {
            IChannel channel = ChannelServices.GetChannel(_channelName);

            if (channel == null)
            {
                _channelSettings["name"] = _channelName;
                _channelSettings["port"] = 0;
                _channelSettings["socketCacheTimeout"] = 0;
                _channelSettings["socketCachePolicy"]  = SocketCachingEnabled ? SocketCachePolicy.Default : SocketCachePolicy.AbsoluteTimeout;
                _channelSettings["secure"]             = false;

                ConfigureEncryption();
                ConfigureCompression();

                if (_channelFactory == null)
                {
                    throw new ApplicationException(LanguageResource.ApplicationException_NoChannelFactorySpecified);
                }

                channel = _channelFactory(_channelSettings, BuildClientSinkChain(), BuildServerSinkChain());
                RemotingHelper.ResetCustomErrorsMode();
            }

            return(channel);
        }
コード例 #14
0
        public static void Unregister(Type objectType, string label = null, bool ignoreCase = false)
        {
            string objectUri = GetObjectUri(objectType, label, ignoreCase);

            try
            {
                lock (SyncRoot)
                {
                    IChannel channel = ChannelServices.GetChannel(objectUri);

                    if (channel != null)
                    {
                        Type      remotingConfigHandlerType          = Type.GetType("System.Runtime.Remoting.RemotingConfigHandler, mscorlib");
                        FieldInfo remotingConfigHandlerFieldInfoInfo = remotingConfigHandlerType.GetField("Info", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

                        Type       identityHolderType = Type.GetType("System.Runtime.Remoting.IdentityHolder, mscorlib");
                        MethodInfo identityHolderMethodInfoRemoveIdentity = identityHolderType.GetMethod("RemoveIdentity", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(string) }, null);

                        object    obj       = remotingConfigHandlerFieldInfoInfo.GetValue(null);
                        FieldInfo fieldInfo = obj.GetType().GetField("_wellKnownExportInfo", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                        obj = fieldInfo.GetValue(obj);
                        Hashtable registeredTypes = (Hashtable)obj;

                        try
                        {
                            identityHolderMethodInfoRemoveIdentity.Invoke(null, new object[] { objectUri });
                            registeredTypes.Remove(objectUri.ToLowerInvariant());
                        }
                        catch
                        {
                        }

                        IpcChannel ipcChannel = channel as IpcChannel;

                        if (ipcChannel != null)
                        {
                            ipcChannel.StopListening(null);
                        }

                        IpcServerChannel ipcServerChannel = channel as IpcServerChannel;

                        if (ipcServerChannel != null)
                        {
                            ipcServerChannel.StopListening(null);
                        }

                        ChannelServices.UnregisterChannel(channel);
                    }
                }
            }
            catch (RemotingException)
            {
            }
            catch (Exception e)
            {
                InternalLogger.Log(e);
                throw;
            }
        }
コード例 #15
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     if (ChannelServices.GetChannel("tcp") != null)
     {
         ChannelServices.UnregisterChannel(tcpChannel);
         txtStatus.Text = "Stop in Port: " + port.ToString() + " at: " + DateTime.Now.ToString();
     }
 }
コード例 #16
0
ファイル: ServiceInterface.cs プロジェクト: y11en/FileWall
        public static void Disconnect(ServiceInterface serviceInterface)
        {
            RemotingServices.Disconnect(serviceInterface);

            var Channel = ChannelServices.GetChannel("FileWallChannel");

            ChannelServices.UnregisterChannel(Channel);
        }
コード例 #17
0
        private void UnRegisterObject()
        {
            //IChannel[] lArrObjRegistedChannels = ChannelServices.RegisteredChannels;
            //IChannel lObjChannel = (IChannel)ChannelServices.GetChannel(lArrObjRegistedChannels[0].ChannelName);
            IChannel lObjChannel = (IChannel)ChannelServices.GetChannel(GetChannelName());

            ChannelServices.UnregisterChannel(lObjChannel);
        }
コード例 #18
0
        void UnregisterAllIPCChannels()
        {
            if (ChannelServices.RegisteredChannels.Length > 0)
            {
                ChannelServices.UnregisterChannel(ChannelServices.GetChannel(ChannelServices.RegisteredChannels[0].ChannelName));

                UnregisterAllIPCChannels();
            }
        }
コード例 #19
0
        public void Connect()
        {
            if (ChannelServices.GetChannel(tcpClient.ChannelName) == null)
            {
                ChannelServices.RegisterChannel(tcpClient, false);
            }

            ActivateObjects();
        }
コード例 #20
0
ファイル: RemotingManager.cs プロジェクト: you8/vvvv-sdk
        //remove channel if it exists
        public static void RemoveChannel(string name)
        {
            var ch = ChannelServices.GetChannel(name);

            if (ch != null)
            {
                ChannelServices.UnregisterChannel(ch);
            }
        }
コード例 #21
0
ファイル: RemotingChannels.cs プロジェクト: yaobos/NCache
 /// <summary>
 /// Registers IPC Client Channel.
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="port"></param>
 public void RegisterIPCClientChannel(string channelName)
 {
     _ipcClientChannel = ChannelServices.GetChannel(channelName);
     if (_ipcClientChannel == null)
     {
         BinaryClientFormatterSinkProvider cprovider = new BinaryClientFormatterSinkProvider();
         _ipcClientChannel = new IpcClientChannel(channelName, cprovider);
         ChannelServices.RegisterChannel(_ipcClientChannel);
     }
 }
コード例 #22
0
        public RemoteTracerServer()
        {
            IChannel clientChannel = ChannelServices.GetChannel("tcp");

            if (clientChannel == null)
            {
                ChannelServices.RegisterChannel(new TcpClientChannel(), false);
            }
            ListenerUrl = "tcp://localhost:15456/RemoteListener";
        }
コード例 #23
0
ファイル: RemotingChannels.cs プロジェクト: yaobos/NCache
 /// <summary>
 /// Registers IPC server channel.
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="port"></param>
 public void RegisterIPCServerChannel(string channelName, string portName)
 {
     _ipcServerChannel = ChannelServices.GetChannel(channelName);
     if (_ipcServerChannel == null)
     {
         BinaryServerFormatterSinkProvider sprovider = new BinaryServerFormatterSinkProvider();
         sprovider.TypeFilterLevel = TypeFilterLevel.Full;
         _ipcServerChannel         = new IpcServerChannel(channelName, portName, sprovider);;
         ChannelServices.RegisterChannel(_ipcServerChannel);
     }
 }
コード例 #24
0
ファイル: RemotingChannels.cs プロジェクト: yaobos/NCache
 /// <summary>
 ///
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="port"></param>
 public void RegisterHttpServerChannel(string channelName, int port)
 {
     _httpServerChannel = ChannelServices.GetChannel(channelName);
     if (_httpServerChannel == null)
     {
         BinaryServerFormatterSinkProvider sprovider = new BinaryServerFormatterSinkProvider();
         sprovider.TypeFilterLevel = TypeFilterLevel.Full;
         _httpServerChannel        = new HttpServerChannel(channelName, port, sprovider);
         ChannelServices.RegisterChannel(_httpServerChannel);
     }
 }
コード例 #25
0
ファイル: Lagfree.cs プロジェクト: vaginessa/LagfreeServices
 private static void InitializeIpc()
 {
     AgentChannel = ChannelServices.GetChannel("LagfreeAgentClient") as IpcClientChannel;
     if (AgentChannel == null)
     {
         AgentChannel = new IpcClientChannel("LagfreeAgentClient", null);
         ChannelServices.RegisterChannel(AgentChannel, true);
     }
     RemotingConfiguration.RegisterWellKnownClientType(typeof(VisiblePids), "ipc://LagfreeAgent/VisiblePids");
     ForegroundPids = new VisiblePids();
 }
コード例 #26
0
ファイル: ChatRoom.cs プロジェクト: netsrotr/GenuineChannels
        /// <summary>
        /// Constructs ChatRoom instance.
        /// </summary>
        public ChatRoom()
        {
            //*** Send the event via IP multicast to the specific court
            IBroadcastSenderProvider iBroadcastSenderProvider = ChannelServices.GetChannel("BroadcastSender") as IBroadcastSenderProvider;

            this._dispatcher.Add(iBroadcastSenderProvider.GetBroadcastSender("/Chat/GlobalRoom"));

            // bind server's methods
            this._dispatcher.BroadcastCallFinishedHandler += new BroadcastCallFinishedHandler(this.BroadcastCallFinishedHandler);
            this._dispatcher.CallIsAsync = true;
        }
コード例 #27
0
        public virtual void ClientDisconnect()
        {
            var channel = ChannelServices.GetChannel("FileWallChannel2");

            if (channel == null)
            {
                throw new InvalidOperationException("Error while disconnecting IPC port. Can't find FileWallChannel2.");
            }

            ChannelServices.UnregisterChannel(channel);
        }
コード例 #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="port"></param>
        public void RegisterHttpClientChannel(string channelName)
        {
#if !NETCORE
            _httpClientChannel = ChannelServices.GetChannel(channelName);
            if (_httpClientChannel == null)
            {
                BinaryClientFormatterSinkProvider cprovider = new BinaryClientFormatterSinkProvider();
                _httpClientChannel = new HttpClientChannel(channelName, cprovider);
                ChannelServices.RegisterChannel(_httpClientChannel);
            }
#endif
        }
コード例 #29
0
        public override void Initialize()
        {
            // Channel already open?
            _channel = ChannelServices.GetChannel(RemotingReceiverChannelName);


            if (_channel == null)
            {
                // Allow clients to receive complete Remoting exception information
                if (RemotingConfiguration.CustomErrorsEnabled(true))
                {
                    RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
                }

                // Create TCP Channel
                try
                {
                    BinaryClientFormatterSinkProvider clientProvider = null;
                    var serverProvider =
                        new BinaryServerFormatterSinkProvider
                    {
                        TypeFilterLevel = TypeFilterLevel.Full
                    };

                    IDictionary props = new Hashtable();
                    props["port"]            = Port.ToString();
                    props["name"]            = RemotingReceiverChannelName;
                    props["typeFilterLevel"] = TypeFilterLevel.Full;
                    _channel = new TcpChannel(props, clientProvider, serverProvider);

                    ChannelServices.RegisterChannel(_channel, false);
                }
                catch (Exception ex)
                {
                    throw new Exception("Remoting TCP Channel Initialization failed", ex);
                }
            }

            var serverType = RemotingServices.GetServerTypeForUri(SinkName);

            if (serverType == null || serverType != typeof(RemotingAppender.IRemoteLoggingSink))
            // Marshal Receiver
            {
                try
                {
                    RemotingServices.Marshal(this, SinkName, typeof(RemotingAppender.IRemoteLoggingSink));
                }
                catch (Exception ex)
                {
                    throw new Exception("Remoting Marshal failed", ex);
                }
            }
        }
コード例 #30
0
        public void TryRegisterClientChannel()
        {
            Uri uri = GetUriFromAddressBase();

            logger.DebugFormat("Creating client channel for URI {0}...", uri);
            var handler = ChannelSelector.Do.GetHandler(uri);

            if (ChannelServices.GetChannel(handler.DefaultName) == null)
            {
                ChannelServices.RegisterChannel(handler.CreateClientChannel(), false);
            }
        }