Services: how to use config file

  • Thread starter Thread starter Amil
  • Start date Start date
A

Amil

I have a .NET service. I need to use a config file that is installed
in the application directory.

Seems like services always run in system32. I don't want to put
my config in this directory.

How can I find out the location of the service .exe at run time so
can get to the config file? Maybe I could pass a command-line
parameter to the service, but don't know how to do that or if I did,
how to get it back.

Amil
 
Have a look at
system.reflection.assembly.getexecutingassembly().location

Glenn Wilson
 
Back
Top