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; } } } }
private static RemotingXmlConfigFileData LoadConfigurationFromXmlFile(string filename) { RemotingXmlConfigFileData data; try { if (filename != null) { return(RemotingXmlConfigFileParser.ParseConfigFile(filename)); } data = null; } catch (Exception exception) { Exception innerException = exception.InnerException as FileNotFoundException; if (innerException != null) { exception = innerException; } throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ReadFailure"), new object[] { filename, exception })); } return(data); }