c# - Multiple service processes (System.ServiceProcess.ServiceBase) in one Windows Service -


i've got 2 service processes (derived system.serviceprocess.servicebase) myservice1 , myservice2.

i'm trying run them both in main() of windows service's programm.cs.

static void main()     {         servicebase[] servicestorun = { new myservice1(), new myservice2() };         servicebase.run(servicestorun);     } 

in onstart methods of both myservice1 , myservice2 write log file can tell running.

the system builds fine , can install service.

but myservice1 runs. myservice2 doesn't thing (i.e. no start-up log entry). when change order in array:

servicebase[] servicestorun = { new myservice2(), new myservice1() } 

only myservice2 runs.

to try bottom of this, i'm using little tool andersonimes.serviceprocess.servicesloader (https://windowsservicehelper.codeplex.com/) around limitation cannot directly debug windows service in visual studio. tool can both services myservice1 , myservice2 start , run next each other. still don't know why windows running first item in servicebase[] servicestorun array.

any ideas?

i found answer here: http://www.bryancook.net/2008/04/running-multiple-net-services-within.html. hidden resource, 'bryan'! helps next developer save time...

the explanation there around servicesdependedon isn't quite matching see in project though. it's not starting them making sure started. check out https://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.servicesdependedon%28v=vs.110%29.aspx well. don't need because not depend on each other.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -