How do i programatically pass in arguments to OnStart method of a Service, which I further need to propagate to the Elapsed event of the Timer inside 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.
At the simplest level: when you call
ServiceBase.Run, you get to give it the service instances to execute. Simply declare this as a public property on your service, and assign prior to callingRun:Then read
SomePropin your service:You can also use the service args, but that is from the external caller (service registration) – not programatically (per the question).