我认为您应该调用Save方法
ConfigurationManager.Save(ConfigurationSaveMode.Modified);ConfigurationManager.RefreshSection("appSettings");编辑
为了能够保存,您必须使用OpenExeConfiguration方法返回的配置对象
//Create the objectConfiguration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);//make changesconfig.AppSettings.Settings["Username"].Value = txtUsername.Text;config.AppSettings.Settings["Password"].Value = txtPassword.Text;//save to apply changesconfig.Save(ConfigurationSaveMode.Modified);ConfigurationManager.RefreshSection("appSettings");此处更多参考ConfigurationManager类



