i have written an Windows Service and added an App.Config. The Layout of the App.Config looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> </startup> <appSettings> <add key="Debug" value="true"/> <add key="Mail-To" value="email@example.com"/> </appSettings> </configuration>
If i make a Build and install the Service, everything works so far and the "default" app.config-Settings are read and everything is fine. But if i change something in the "Service.App.Config" the new values are never read. Even if i restart the Service, the values stay the same. I googled and tried it with this code:
var appSettings = ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetEntryAssembly().Location).AppSettings; bool disarmed = Convert.ToBoolean(appSettings.Settings["Debug"].Value);
but even this does not help. Maybe someone can give me a hint how to resolve this and get the new values after i changed them in the App.Config.
Best Regards, Hendrik