Re: [topshelf-discuss] Using command-line args that TopShelf doesn't recognize

1,920 views
Skip to first unread message

Dru Sellers

unread,
Oct 21, 2012, 9:21:36 AM10/21/12
to topshelf...@googlegroups.com
sounds like you figured it out, yes?

-d

On Fri, Oct 19, 2012 at 5:45 PM, Hugh Williams <hughbi...@gmail.com> wrote:
I have a TopShelf-based service and I'm trying to tell it where to get config information when I run it from the command prompt. The idea is that I can have Visual Studio specify a config file when it debugs the app, but when it runs as a deployed service, it should just use a default configuration strategy that's baked in.

I'm trying to pass a command-line argument to my TopShelf executable like so:

MyTopShelfService.exe --config C:\somepath\config.json

But I'm getting errors like this:
2012-10-19 18:00:28,302 Main ERROR Topshelf.HostFactory The service terminated abnormally
Topshelf.HostConfigurationException: The service was not properly configured: 
[Failure] Command Line An unknown command-line option was found: SWITCH: config (True)
[Failure] Command Line An unknown command-line option was found: ARGUMENT: C:\somepath\config.json

I had a peek at the code and it looks like it's just treating this as an UnknownOption.

Is there a way to pass in command-line args that TopShelf should ignore, but that should flow through to my code? I'm thinking maybe something like the way Java apps pass in properties with -D or something?



Hugh Williams

unread,
Oct 22, 2012, 8:59:13 AM10/22/12
to topshelf...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages