Automatic Updating of app.config

  • Thread starter Thread starter miannone
  • Start date Start date
M

miannone

I was hoping someone could help me out.

I have created a WindowsService that runs periodically throughout the day using a timer. This windows service looks into a Microsoft SQL database and looks at a few tables and performs a few operations. It uses a app.config file to read in some settings, such as: database connection string, time to perform its operations, etc
This all works well, however if the app.config file is changes (ex. change the time to perform actions), the windows service is not updated unless you stop the service, build and reinstall it, and then start it up again. - which isnt an option

I have not tried changing the executableName.exe.config file, since I want to be able to change the app.config file directly. I have looked around on the internet and found many people with similar problems, but have not found a good solution to the problem.

As a last resort I could read directly from the app.config file periodically, but would much rather use ConfigurationSettings.AppSettings or something similar to that to automatically read in the values. I would rather not have the trouble of reading from the file manually, since if it is currently opened it may get complicated.
Currently when the time interval elapses and it checks which actions need to be performed, it also reads in the the config file using ConfigurationSettings.AppSettings. However, this information may be out of date. I would like a way to update this data somehow when the app.config file is manually changed while the windows service is running.

If anyone has encountered similar problems or has any suggestions as to how I can do this please let me know

Thanks

Mike.
 
I decided just to create my own xml configuration file. When I looked into it, it was a lot easier to set it up than I thought. Although using the app.config file would still be my preference.
 
Back
Top