I have a bit weird situation. In the onstart
method of a windows service if I put following code:
File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "\\TestFile.txt", "Started " + AppDomain.CurrentDomain.BaseDirectory);
it works and inside text file this is stored:
Started C:\Users\guser\Documents\Visual Studio 2012\Projects\FreeSpaceControlService\FreeSpaceControlService\bin\Debug\
The text file is created inside debug directory.
But if I use such code instead of the above(at the same place):
File.AppendAllText("TestFile.txt", "Started");
The text file is not created in the same directory as above. Why it is not created in the same directory? (It seems it was created in WIndows/System32 now that I check it - are there two executables? Why did the first return Debug directory?)
and where you typically(in which path) store settings for windows service and logs?