In a windows forms application, I use Application.Executable path to get to the App.config.,
I need to get to app.config in Windows Service.. What would that be ?
A couple of options:
System.Reflection.Assembly.GetExecutingAssembly().Location
For the current assembly. or, you can derive it from a type:
System.Reflection.Assembly.GetAssembly(typeof(MyAssemblyType)).Location
Then (on either) you can use Path.GetDirectoryName
to get the folder it's originating from (assuming your app.config is within that same directory).
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