Skip to content

Instantly share code, notes, and snippets.

@trullock
Created November 9, 2012 11:03
Show Gist options
  • Save trullock/4045159 to your computer and use it in GitHub Desktop.
Save trullock/4045159 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
HostFactory.Run(x =>
{
x.Service<IService>(s =>
{
s.SetServiceName("bar");
s.ConstructUsing(name =>
{
try
{
return new MyService();
}
catch (Exception e)
{
Console.WriteLine(e);
throw e;
}
});
s.WhenStarted(r => r.Start());
s.WhenStopped(r => r.Stop());
});
x.SetDescription("foo");
x.SetDisplayName("bar");
x.SetServiceName("bar");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment