internal void StoreRemoteAppEntries(RemotingXmlConfigFileData configData)
 {
     char[] trimChars = new char[] { '/' };
     foreach (RemotingXmlConfigFileData.RemoteAppEntry entry in configData.RemoteAppEntries)
     {
         string appUri = entry.AppUri;
         if ((appUri != null) && !appUri.EndsWith("/", StringComparison.Ordinal))
         {
             appUri = appUri.TrimEnd(trimChars);
         }
         foreach (RemotingXmlConfigFileData.TypeEntry entry2 in entry.ActivatedObjects)
         {
             ActivatedClientTypeEntry entry3 = new ActivatedClientTypeEntry(entry2.TypeName, entry2.AssemblyName, appUri)
             {
                 ContextAttributes = CreateContextAttributesFromConfigEntries(entry2.ContextAttributes)
             };
             RemotingConfiguration.RegisterActivatedClientType(entry3);
         }
         foreach (RemotingXmlConfigFileData.ClientWellKnownEntry entry4 in entry.WellKnownObjects)
         {
             WellKnownClientTypeEntry entry5 = new WellKnownClientTypeEntry(entry4.TypeName, entry4.AssemblyName, entry4.Url)
             {
                 ApplicationUrl = appUri
             };
             RemotingConfiguration.RegisterWellKnownClientType(entry5);
         }
     }
 }
 private static void LoadMachineConfigIfNecessary()
 {
     if (!_bMachineConfigLoaded)
     {
         lock (Info)
         {
             if (!_bMachineConfigLoaded)
             {
                 RemotingXmlConfigFileData configData = RemotingXmlConfigFileParser.ParseDefaultConfiguration();
                 if (configData != null)
                 {
                     ConfigureRemoting(configData, false);
                 }
                 string path = Config.MachineDirectory + "machine.config";
                 new FileIOPermission(FileIOPermissionAccess.Read, path).Assert();
                 configData = LoadConfigurationFromXmlFile(path);
                 if (configData != null)
                 {
                     ConfigureRemoting(configData, false);
                 }
                 _bMachineConfigLoaded = true;
             }
         }
     }
 }
 internal void StoreInteropEntries(RemotingXmlConfigFileData configData)
 {
     foreach (RemotingXmlConfigFileData.InteropXmlElementEntry entry in configData.InteropXmlElementEntries)
     {
         Type type = Assembly.Load(entry.UrtAssemblyName).GetType(entry.UrtTypeName);
         SoapServices.RegisterInteropXmlElement(entry.XmlElementName, entry.XmlElementNamespace, type);
     }
     foreach (RemotingXmlConfigFileData.InteropXmlTypeEntry entry2 in configData.InteropXmlTypeEntries)
     {
         Type type2 = Assembly.Load(entry2.UrtAssemblyName).GetType(entry2.UrtTypeName);
         SoapServices.RegisterInteropXmlType(entry2.XmlTypeName, entry2.XmlTypeNamespace, type2);
     }
     foreach (RemotingXmlConfigFileData.PreLoadEntry entry3 in configData.PreLoadEntries)
     {
         Assembly assembly = Assembly.Load(entry3.AssemblyName);
         if (entry3.TypeName != null)
         {
             SoapServices.PreLoad(assembly.GetType(entry3.TypeName));
         }
         else
         {
             SoapServices.PreLoad(assembly);
         }
     }
 }
        internal static void DoConfiguration(string filename, bool ensureSecurity)
        {
            LoadMachineConfigIfNecessary();
            RemotingXmlConfigFileData configData = LoadConfigurationFromXmlFile(filename);

            if (configData != null)
            {
                ConfigureRemoting(configData, ensureSecurity);
            }
        }
 internal void StoreWellKnownExports(RemotingXmlConfigFileData configData)
 {
     foreach (RemotingXmlConfigFileData.ServerWellKnownEntry entry in configData.ServerWellKnownEntries)
     {
         WellKnownServiceTypeEntry entry2 = new WellKnownServiceTypeEntry(entry.TypeName, entry.AssemblyName, entry.ObjectURI, entry.ObjectMode)
         {
             ContextAttributes = null
         };
         RemotingConfigHandler.RegisterWellKnownServiceType(entry2);
     }
 }
 internal void StoreActivatedExports(RemotingXmlConfigFileData configData)
 {
     foreach (RemotingXmlConfigFileData.TypeEntry entry in configData.ServerActivatedEntries)
     {
         ActivatedServiceTypeEntry entry2 = new ActivatedServiceTypeEntry(entry.TypeName, entry.AssemblyName)
         {
             ContextAttributes = CreateContextAttributesFromConfigEntries(entry.ContextAttributes)
         };
         RemotingConfiguration.RegisterActivatedServiceType(entry2);
     }
 }
 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));
         }
     }
 }
 private static void ConfigureRemoting(RemotingXmlConfigFileData configData, bool ensureSecurity)
 {
     try
     {
         string applicationName = configData.ApplicationName;
         if (applicationName != null)
         {
             ApplicationName = applicationName;
         }
         if (configData.CustomErrors != null)
         {
             _errorMode = configData.CustomErrors.Mode;
         }
         ConfigureChannels(configData, ensureSecurity);
         if (configData.Lifetime != null)
         {
             if (configData.Lifetime.IsLeaseTimeSet)
             {
                 LifetimeServices.LeaseTime = configData.Lifetime.LeaseTime;
             }
             if (configData.Lifetime.IsRenewOnCallTimeSet)
             {
                 LifetimeServices.RenewOnCallTime = configData.Lifetime.RenewOnCallTime;
             }
             if (configData.Lifetime.IsSponsorshipTimeoutSet)
             {
                 LifetimeServices.SponsorshipTimeout = configData.Lifetime.SponsorshipTimeout;
             }
             if (configData.Lifetime.IsLeaseManagerPollTimeSet)
             {
                 LifetimeServices.LeaseManagerPollTime = configData.Lifetime.LeaseManagerPollTime;
             }
         }
         _bUrlObjRefMode = configData.UrlObjRefMode;
         Info.StoreRemoteAppEntries(configData);
         Info.StoreActivatedExports(configData);
         Info.StoreInteropEntries(configData);
         Info.StoreWellKnownExports(configData);
         if (configData.ServerActivatedEntries.Count > 0)
         {
             ActivationServices.StartListeningForRemoteRequests();
         }
     }
     catch (Exception exception)
     {
         throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ConfigurationFailure"), new object[] { exception }));
     }
 }