You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
I should be able to follow the directions and specify a custom XML configuration filename, but WinSW errors out every time because it does not see a configuration file the same name as the executable. Example: WinSW.NET461.xml or WinSW-x64.xml
Steps to reproduce
Log in to your Windows 11 desktop
Download your preferred flavor of WinSW (Tested using WinSW-x64 and WinSW.NET461 v2.12.0) to a directory (like C:\WinSW)
Create a Configuration File (Mine is posted below) and save it in the directory.
Open Windows PowerShell (5.1) as an Administrator
Change directory to the preferred directory (using C:\WinSW in this example, did test with other directories)
Run .\WinSW.exe install <CONFIGFILENAME>. (Replace WinSW.exe with whatever filename you use for WinSW. I am using the .NET461 version in this reproduction steps, though it also reproduces with x64 version.)
The output from my testing looks like this:
PS C:\winsw> ls
Directory: C:\winsw
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 8/1/2023 4:27 AM 1000 blackbox_config.yml
-a---- 10/11/2023 11:12 AM 20358656 blackbox_exporter.exe
-a---- 10/11/2023 11:10 AM 317 blackbox_service.xml
-a---- 10/11/2023 1:27 PM 655872 WinSW.exe
-a---- 10/11/2023 1:27 PM 655872 WinSW.NET461.exe
PS C:\winsw> .\WinSW.exe install .\blackbox_service.xml
2023-10-11 13:49:47,883 FATAL - Unhandled exception
System.IO.FileNotFoundException: Unable to locate WinSW.[xml|yml] file within executable directory
at WinSW.Program.LoadConfigAndInitLoggers(Boolean inConsoleMode)
at WinSW.Program.Run(String[] argsArray, IServiceConfig config)
at WinSW.Program.Main(String[] args)
PS C:\winsw> mv .\blackbox_service.xml WinSW.xml
PS C:\winsw> .\WinSW.exe install .\WinSW.xml
2023-10-11 13:50:52,507 INFO - Installing service 'Blackbox Exporter (blackbox_exporter)'...
2023-10-11 13:50:52,522 INFO - Service 'Blackbox Exporter (blackbox_exporter)' was installed successfully.
Additional Output from different compile targets:
PS C:\winsw> .\WinSW.NET4.exe install .\WinSW.xml
2023-10-11 15:17:32,546 FATAL - Unhandled exception
System.IO.FileNotFoundException: Unable to locate WinSW.NET4.[xml|yml] file within executable directory
at WinSW.Program.LoadConfigAndInitLoggers(Boolean inConsoleMode)
at WinSW.Program.Run(String[] argsArray, IServiceConfig config)
at WinSW.Program.Main(String[] args)
PS C:\winsw> .\WinSW.NET461.exe install .\WinSW.xml
2023-10-11 15:17:50,749 FATAL - Unhandled exception
System.IO.FileNotFoundException: Unable to locate WinSW.NET461.[xml|yml] file within executable directory
at WinSW.Program.LoadConfigAndInitLoggers(Boolean inConsoleMode)
at WinSW.Program.Run(String[] argsArray, IServiceConfig config)
at WinSW.Program.Main(String[] args)
PS C:\winsw> .\WinSW-x64.exe install .\WinSW.xml
2023-10-11 15:18:02,053 FATAL - Unhandled exception
System.IO.FileNotFoundException: Unable to locate WinSW-x64.[xml|yml] file within executable directory
at WinSW.Program.LoadConfigAndInitLoggers(Boolean inConsoleMode)
at WinSW.Program.Run(String[] argsArray, IServiceConfig config)
at WinSW.Program.Main(String[] args)
Here is my configuration file
<service>
<id>blackbox_exporter</id>
<name>Blackbox Exporter</name>
<description>This service runs the Prometheus Blackbox Exporter</description>
<executable>blackbox_exporter.exe</executable>
<arguments>--config.file=blackbox_config.yml</arguments>
<logmode="roll"></log>
</service>
Environment
WinSW version: 2.12.0
WinSW package type: .NET 4.61, x64
Windows version: Windows 11 ARM Edition on Parallels
I figured out the problem. The default documentation page is for v3.0 and the "latest release" is v2.0, so a new user can get confused (like I did) very quickly when the documentation doesn't match the behavior.
When I downloaded the pre-release Alpha for testing, the behavior worked as expected with respect to the config file name. Now that I know this, I'm refactoring my Windows PowerShell script to support v2.x behavior because our organization does not permit running pre-release software.
To the maintainers, please leave v2 as your default documentation until v3 is officially the "latest release".
Summary
I should be able to follow the directions and specify a custom XML configuration filename, but WinSW errors out every time because it does not see a configuration file the same name as the executable. Example: WinSW.NET461.xml or WinSW-x64.xml
Steps to reproduce
.\WinSW.exe install <CONFIGFILENAME>
. (ReplaceWinSW.exe
with whatever filename you use for WinSW. I am using the .NET461 version in this reproduction steps, though it also reproduces with x64 version.)Additional Output from different compile targets:
Here is my configuration file
Environment
The text was updated successfully, but these errors were encountered: