Cloud Stack Ninja

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" ?>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
        <add key="Debug" value="true"/>
        <add key="Mail-To" value=""/>

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

Read more here:

Content Attribution

This content was originally published by Hendriks91 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: