Topshelf no longer supports this, but the possible work is to implement a class to run multiple services.
Example:
hostConfigurator.Service<ServiceManager>(s =>
{
s.ConstructUsingNinject();
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
The ServiceManager class then starts and stops several services.
public class ServiceManager
{
private readonly Service1 service1;
private readonly Service2 service2;
public ServiceManager(Service1 service1, Service2 service2)
{
this.service1= service1;
this.service2= service2;
}
public void Start()
{
service1.Start();
service2.Start();
}
public void Stop()
{
service1.Stop();
service2.Stop();
}
}
source
share