config file with a service

  • Thread starter Thread starter Sam Martin
  • Start date Start date
S

Sam Martin

just a quick one,

a colleague is writing a windows service, in c#. problem is the app.config
is only picked up when the service installs. i.e. subsequent changes to the
config file and then restart the service has no effect.

is this correct, app config settings are "set" on install and to change
them, you need to reinstall the service?

any ideas welcome.
tia
sam martin
 
Sam,

No, this is not correct. Are you truly shutting down the service, or
are you only pausing it? The app config file is read when the CLR starts up
for the process. Also, are you sure that the app config file is set to the
name of your executable, and not the install executable?
 
thanks nick, you're a star as ever. he's realised the error of his ways.

using a harness to test the onstart event of the service. the process isn't
oviously restarting, just the service in the process.

he says thanks

cheers
sam

Nicholas Paldino said:
Sam,

No, this is not correct. Are you truly shutting down the service, or
are you only pausing it? The app config file is read when the CLR starts
up for the process. Also, are you sure that the app config file is set to
the name of your executable, and not the install executable?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sam Martin said:
just a quick one,

a colleague is writing a windows service, in c#. problem is the
app.config is only picked up when the service installs. i.e. subsequent
changes to the config file and then restart the service has no effect.

is this correct, app config settings are "set" on install and to change
them, you need to reinstall the service?

any ideas welcome.
tia
sam martin
 
Back
Top