Is there a way to pass 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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 theactivationAttributestoAppDomain.CreateInstanceAndUnwrap Method (String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]), but being ignored in the call toOnStart.You could try compiling a modified version of
mono-service.exeusing the following source:* see github gist or commit for review
Compile to
mono-service.exewith-r:System.ServiceProcess.dll -r:Mono.Posix.dll -unsafeOLDER 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: