如何找到动态安装windows服务.exe文件的文件夹?
Path.GetFullPath(relativePath);
返回基于 C:\WINDOWS\system32
目录的路径。
但是,XmlDocument.Load(string filename)
方法似乎针对服务 .exe 文件安装目录内的相对路径起作用。
最佳答案
尝试
System.Reflection.Assembly.GetEntryAssembly().Location
关于c# - 获取 Windows 服务的完整路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/199961/