System.Runtime.Remoting.RemotingServices.RegisterWellKnownChannels C# (CSharp) Метод

RegisterWellKnownChannels() статический приватный Метод

static private RegisterWellKnownChannels ( ) : bool
Результат bool
        internal static bool RegisterWellKnownChannels()
        {
            // Any code coming through this method MUST not exit
            //   until the well known channels have been registered
            //   (unless we are reentering in the call to 
            //    RefreshChannelData() while registering a well known
            //    channel).
            if (!s_bRegisteredWellKnownChannels)
            {
                bool fLocked = false;
                Object configLock = Thread.GetDomain().RemotingData.ConfigLock;
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    Monitor.ReliableEnter(configLock, ref fLocked);
                    if (!s_bRegisteredWellKnownChannels &&
                        !s_bInProcessOfRegisteringWellKnownChannels)
                    {

                        // we set this flag true before registering channels to prevent reentrancy
                        //   when we go to refresh the channel data at the end of the call to
                        //   ChannelServices.RegisterChannel().
                        s_bInProcessOfRegisteringWellKnownChannels = true;
                        CrossAppDomainChannel.RegisterChannel();
                        s_bRegisteredWellKnownChannels = true;
                    }
                }
                finally
                {
                    if (fLocked)
                    {
                        Monitor.Exit(configLock);
                    }
                }
            }
            return true;
        } // RegisterWellKnownChannels

Usage Example

 private static void ConfigureChannels(RemotingXmlConfigFileData configData, bool ensureSecurity)
 {
     RemotingServices.RegisterWellKnownChannels();
     foreach (RemotingXmlConfigFileData.ChannelEntry entry in configData.ChannelEntries)
     {
         if (!entry.DelayLoad)
         {
             ChannelServices.RegisterChannel(CreateChannelFromConfigEntry(entry), ensureSecurity);
         }
         else
         {
             _delayLoadChannelConfigQueue.Enqueue(new DelayLoadClientChannelEntry(entry, ensureSecurity));
         }
     }
 }
RemotingServices