config file with a service

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
 
N

Nicholas Paldino [.NET/C# MVP]

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?
 
S

Sam Martin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top