winform程序,自定义一个xml配置文件,想要实现不需要重启程序的前提下修改xml配置文件即可生效
//修改配置
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa.AppSettings.Settings["LastExecuteTime"].Value = DateTime.Now.ToShortDateString(); ;
//最后调用
cfa.Save();
ConfigurationManager.RefreshSection("appSettings");
web应用,可以考虑文件依赖缓存;winform应用,考虑采用System.IO.FileSystemWatcher
谢谢大神们,已经解决了,思路是这样:用 FileSystemWatcher 监视 xml文件, changed 的时候 触发下更新参数
调用接口刷新一下就行了