The winform program configuration file is read into the cache after the winform program is started. to modify the configuration file through the program, you must restart the winform program to read the updated configuration file.
Add reference system. after configuration, you can use configurationmanager. refreshsection ("etettings") method to refresh the appsettings node. After refreshing, you do not need to restart the winform program. You can read the updated configuration file information;
Configurationmanager. the refreshsection method is used to refresh the content read to the cache, but the refreshsection refreshes only a limited number of nodes and custom nodes cannot be refreshed. For example, my winform client is connected to the WCF Service, the node of the WCF Service in the configuration file is: "system. servicemodel/client ", this node cannot be refreshed through the refreshsection method, but can only restart the winform program.
Configuration File refresh configurationmanager. refreshsection usage Problems