How do I read an .ini-file with a Win service on Windows7
Posted on 2010-11-24
I have installed my Service and the .exe-file is located in C:\Program Files (x86)\MyService. I want to read some values from a .ini-file that also should be located in the same folder.
I have previously used the following code to read file in the same folder as the service exe-file : path = Environment.CurrentDirectory + "\\Mysettings.ini";
When I debug the service I can see that Mysettings.ini must be located in c:\windows\syswow64 to get it to work. What other code than Environment.CurrentDirectory should I use to get the right path ?