Perhaps I did not understand you completely, but I think you just need to get the place you work from, and then get the root from it.
Path.GetPathRoot(Assembly.GetEntryAssembly().Location);
Update
special folders are what you need to explore. It is not so easy to do this because your question is not detailed enough. If the service works as a specific user or as a system, it matters. In addition, you did not indicate how it was used to make a difference. Is this a place to store configuration files against a temporary location to write vs files if someone else wants to get into a folder? All of this matters, so if you add more data, I will update the answer.
source share