regarding the location of config files for the .net windows servic

G

Guest

hi all

i wrote a windows service.
i am trying to get it to use an app.config file.
unfortunately, when the service starts,
it assumes that the ConfigurationSettings file
is in C:\Windows\System32.

this is unacceptable to me.
rather, i would like the service to assume that the app.config file is in
the same directory as the .net windows service exe

can i do this?

Thanks

With Regards
Vinoth Kumar.V.K
 
E

Erik

Hi,

As far as I was aware it alreadyu does this? I have written many
service applications using the app.config file and it has always
picked it up correctly from the directory that the EXE was running.
Not sure how it does this as you correctly state the service uses the
c:\windows\system32 as it's working directory as it runs wihtin the
svchost.

Have you tried an compile any example services from the net and see if
you get the same problem?

Cheers,

Erik
 
E

Erik

Thinking about it, it you wanted to try setting
Environment.Currentdirectory in your onstart event to your working
directory and see if that works?
 

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