You might find some useful hints here:
http://www.eggheadcafe.com/articles/20041204.asp
// nasty bug in FileSystemWatcher fires twice (in about 4 ms) on changed
file. This is a workaround...
I'm not sure if it will help you, but sometimes its nice to see what someone
else tried.
"Jeff Mason" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to write some code that will detect changes in a Windows
> Service app's
> .config file and reflect the modified appSetting entry in my code.
>
> We have a windows Service we've written and every once in a while we need
> to modify a
> setting in its .config file. Right now we restart the service whenever
> the config
> entry changes.
>
> We'd like to have the .config update be recognized automatically.
>
> It's easy enough to hang a FileSystemWatcher off the application's .config
> file to
> detect a change. In the event handler I am executing:
>
> ConfigurationManager.RefreshSection("appSettings")
>
> but this seems to have no effect. The value returned by subsequently
> referencing
> ConfigurationManager.AppSettings(<somekey>) is the original value, not the
> one just
> changed.
>
> The help for RefreshSection claims: "Refreshes the named section so the
> next time it
> is retrieved it will be re-read from disk." but this doesn't appear to
> work.
>
> What am I doing wrong?
>
> Thanks for any help.
>
> - Jeff
>
> -- Jeff