关于app。config更新节点问题

.Net技术 码拜 8年前 (2016-05-29) 929次浏览
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
AppSettingsSection appSettings = (AppSettingsSection)config.GetSection(“appSettings”);
appSettings.Settings.Remove(“UdpServerIP”);
appSettings.Settings.Remove(“UdpServerPort”);
appSettings.Settings.Remove(“App_id”);
appSettings.Settings.Remove(“Login_name”);
appSettings.Settings.Remove(“Login_pwd”);
appSettings.Settings.Remove(“Login_type”);
appSettings.Settings.Remove(“SiteNoSNum”);
appSettings.Settings.Add(“UdpServerIP”, tbUdpServerIP.Text);
appSettings.Settings.Add(“UdpServerPort”, tbUdpServerPort.Text);
appSettings.Settings.Add(“App_id”, tbApp_id.Text);
appSettings.Settings.Add(“Login_name”, tbLogin_name.Text);
appSettings.Settings.Add(“Login_pwd”, tbLogin_pwd.Text);
appSettings.Settings.Add(“Login_type”, tbLogin_type.Text);
appSettings.Settings.Add(“SiteNoSNum”, ptModel.siteNoSNum);
config.Save();
ConfigurationManager.RefreshSection(“appSettings”);
为什么节点不更新,那地方写的有问题
解决方案

10

http://www.cnblogs.com/LoveJenny/archive/2011/07/11/2103419.html

10

可以使用Glacier 框架的配置功能 https://www.gkarch.com/docs/config/
支持独立 HOCON 配置文件

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于app。config更新节点问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)