Configuration file location

  • Thread starter Thread starter TomB
  • Start date Start date
T

TomB

I've written a windows service. I'd like to read in values from an xml file
to use in the service. If I add an xml file to the project it doesn't get
added to the \bin folder. When I eventually get around to packaging it, the
folder that the xml is in will be different again.
I was going to just force it to fit in app.config. But app.config isn't
"re-read" until the app is restarted so that's no good.

This has to be a fairly basic thing. How should this be done?

Thanks.
Tom B
 
When you package the windows service (assuming you are using a installation project?), do you specifically say where the XML file is located? i.e. add a folder named "bin" and then say i want that file to live there

Cheers
Jonathan Ruckert
 
Ahh. OK. Thanks a lot.
Tom

Jonathan Ruckert said:
When you package the windows service (assuming you are using a
installation project?), do you specifically say where the XML file is
located? i.e. add a folder named "bin" and then say i want that file to live
there?
 
Hi Tom,

I had a similar situation to yours, mine was a little more complicated as
it also needs to be used on a PocketPC application, therefore what I
decided at the end was use a simple .txt file with a variable=value
structure, then I parse that file on code. In the windows service I also use
a FileSystemWatcher on that file, in this way I can change it without need
to stop the service.

I can send you the code if you want. but it's extremely simple to do.

Cheers,
 
Back
Top