rgilchrist
Programmer
Hi
I am trying to run 2 WIN Services from one executable, although both services install and run perfectly when installed on their own. When I use the code
static void Main(string[] args)
{
ServiceBase sb1 = new Service1();
ServiceBase sb2 = new Service2();
sb1.ServiceName = "Service1";
sb2.ServiceName = "Service2";
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] {sb1,sb2};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
Both services install, but when I start them, the second service listed in the ServicesToRun (in this case sb2) always executes the first service's OnStart method.
Can anyone help?
Cheers Rob
I am trying to run 2 WIN Services from one executable, although both services install and run perfectly when installed on their own. When I use the code
static void Main(string[] args)
{
ServiceBase sb1 = new Service1();
ServiceBase sb2 = new Service2();
sb1.ServiceName = "Service1";
sb2.ServiceName = "Service2";
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] {sb1,sb2};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
Both services install, but when I start them, the second service listed in the ServicesToRun (in this case sb2) always executes the first service's OnStart method.
Can anyone help?
Cheers Rob