コード例 #1
0
        private void UpdateServiceConfigurations(CloudServiceProject service, string forwarderName)
        {
            foreach (ServiceConfiguration config in new[] { service.Components.LocalConfig, service.Components.CloudConfig })
            {
                foreach (RoleSettings role in config.Role)
                {
                    if (role.ConfigurationSettings != null)
                    {
                        ConfigurationSetting setting = role.ConfigurationSettings.
                                                       FirstOrDefault <ConfigurationSetting>(t => t.name.Equals(
                                                                                                 "Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled"));
                        if (setting != null)
                        {
                            setting.value = "false";
                        }

                        if (role.name == forwarderName)
                        {
                            ConfigurationSetting forwarderSetting = role.ConfigurationSettings.
                                                                    FirstOrDefault <ConfigurationSetting>(t => t.name.Equals(
                                                                                                              "Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled"));
                            if (forwarderSetting != null)
                            {
                                forwarderSetting.value = "false";
                            }
                        }
                    }
                }
            }
        }