app.config for a Windows service does not work on the fly


I wrote a Windows Service program, say myService.exe and it has myService.exe.config file. But it seems changes to the app.config is not repected by the service until the service is restarted. So, is this by design? Or how could I make my service always respects the config file change without restarting?


This is by design, it doesn't work the same as a web.config file.

You can use a FileSystemWatcher object to monitor for changes to the config file, and take an appropriate action if the file changes.