Skip to content

Instantly share code, notes, and snippets.

@alfeg
Created March 20, 2011 19:37
Show Gist options
  • Save alfeg/878596 to your computer and use it in GitHub Desktop.
Save alfeg/878596 to your computer and use it in GitHub Desktop.
Topshelf configurator example
RunConfiguration cfg = RunnerConfigurator.New(
x =>
{
x.ConfigureService<SomeClass>(c =>
{
c.WhenStarted(s => s.BootHost());
c.WhenStopped(s => s.ShutDownHost());
c.WhenPaused(s => s.ShutDownHost());
c.WhenContinued(s => s.BootHost());
c.HowToBuildService(
s => new SomeClass());
});
x.SetDescription("My Service");
x.SetDisplayName("Display name for service");
x.SetServiceName(AppConfig.ServiceName);
x.RunAs(AppConfig.ServiceUser, AppConfig.ServicePassword);
x.DependencyOnMsmq();
});
Runner.Host(cfg, args);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment