How can I find out the folder where the windows service .exe file is installed dynamically?
Path.GetFullPath(relativePath);
returns a path based on C:\WINDOWS\system32
directory.
However, the XmlDocument.Load(string filename)
method appears to be working against relative path inside the directory where the service .exe file is installed to.
The physical path is 'C:\WINDOWS\TEMP\. net\FreshIQAppMessagingService\zu4jbgzc. let AppDomain.
To change the executable path of ServiceDesk go to below-mentioned location from registry. run -> regedit -> navigate to the below-mentioned location and highlight the ServiceDesk and from the right-hand side edit the ImagePath as required.
Click the Start button in the Windows taskbar. In the menu, right-click Command Prompt. On the pop-up right click context menu, select Run as administrator. At the command prompt, enter the SC Config command with the service name to be modified and the parameters to be changed.
Try
System.Reflection.Assembly.GetEntryAssembly().Location
Try this:
AppDomain.CurrentDomain.BaseDirectory
(Just like here: How to find windows service exe path)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With