I have a windows service that is referencing another assembly (class library). In this other assembly I used Application Settings to store some values. When I copy all the required files to the server I can see these settings in AssemblyName.dll.config file.
However, when I change a setting in this config file and restart the service the change has no effect. Even if I uninstall/reinstall the service it still returns the old value at runtime.
Config file:
<setting name="RecordLimit" serializeAs="String">
<value>300</value>
</setting>
Code:
if (recordCount > Settings.Default.RecordLimit) //always 300
So even if I change the value in the config file to 400 and restart or even reinstall the service, the value is always 300 making me think that this value is stored in and returned from the compiled code.
What am I doing wrong and is it possible that changes to application settings always require a recompile and reinstall (I understand that I can use Save()
method to change the settings from code but this is a windows service so using this method doesn't seem to make sense)?
If these settings stored in the config file have no effect and the settings are stored in the compiled code, can I safely remove these config files?
If these settings cannot be changed without recompiling what other options I have to store setting that I can change without recompling?
EDIT: I just removed the AssemblyName.dll.config file and the code returned 300 so the config file is irrelevant apparently.