Services: how to use config file

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
 
G

Glenn Wilson

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

Glenn Wilson
 

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