开发者

Passing command line arguments to mono-service

开发者 https://www.devze.com 2023-04-10 00:29 出处:网络
Is there a way to pass开发者_C百科 command line arguments to a service invoked by mono-service? All of the command line arguments seem to be absorbed by mono-service instead of passed to the service.

Is there a way to pass开发者_C百科 command line arguments to a service invoked by mono-service? All of the command line arguments seem to be absorbed by mono-service instead of passed to the service.


Update: as per my patch that went in end 2011 you can now use the intended interface of mono-service.


AFAICT there is no way.

The idiomatic way to do things would be to use an app.config file to contain Configuration Sections (in XML).

Update

That seems odd. The assebmblyArgs [sic] are being passed as part of the activationAttributes to AppDomain.CreateInstanceAndUnwrap Method (String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]), but being ignored in the call to OnStart.

You could try compiling a modified version of mono-service.exe using the following source:

* see github gist or commit for review

Compile to mono-service.exe with -r:System.ServiceProcess.dll -r:Mono.Posix.dll -unsafe


OLDER STUFF:

Update 1 Strike that. Judging from the code you should just be able to pass options trailing the assembly name.

This implies that the following should do what you expect:

 mono-service -l:/root/service-lock MyService.exe /Param1 /Param2 bla.txt

0

精彩评论

暂无评论...
验证码 换一张
取 消