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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Thinking about it, it you wanted to try setting
Environment.Currentdirectory in your onstart event to your working
directory and see if that works?
 
Back
Top