Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created July 24, 2015 02:39
Show Gist options
  • Save dcomartin/cc6224560a4087adf4f1 to your computer and use it in GitHub Desktop.
Save dcomartin/cc6224560a4087adf4f1 to your computer and use it in GitHub Desktop.
HostFactory.Run(x =>
{
x.Service<TopshelfService>(s =>
{
s.ConstructUsing(name => new TopshelfService());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("This is a demonstration of a Windows Service using Topshelf.");
x.SetDisplayName("Self Host Web API Demo");
x.SetServiceName("AspNetSelfHostDemo");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment