Windows Service and App.Config problem

  • Thread starter Thread starter Tommy
  • Start date Start date
T

Tommy

I have a windows service that has an app config file. I also have a
filesystem watcher watching the config file.

When the config file changes I am reading the values back into memory. It
all appears to work but the values coming back from the app.config are
always the same until i stop and restart the service.

Aparently the file is being cached. I am using the file that is installed
with my service and i'm sure my event is firing from the filesystem watcher
because it's writing a message i created to the event log.

I am reading the values from my app.confg file with
System.Configuration.ConfigurationSettings.AppSettings(cParameter)

Any ideas why this does not see the new values of my file and how I can get
around this problem?

Thanks in advance.
 
Tommy,
You are right, config file setting does get cached! Only time they
will be updated again is if you restart the service. For this reason
you can not use ConfigurationSettings.AppSettings! But you can have
some global variables that gets updated from watcher. I hope this
helps.

JK
 
Back
Top