Last active
August 29, 2015 14:08
-
-
Save scottlittlewood/8e956cc18136fe6670b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var serviceNamespace = typeof (Service).Namespace; | |
HostFactory.Run(x => | |
{ | |
x.Service<IService>(s => | |
{ | |
s.ConstructUsing(n => new Service()); | |
s.WhenStarted(tc => tc.Start()); | |
s.WhenStopped(tc => tc.Stop()); | |
}); | |
x.RunAsLocalSystem(); | |
x.SetDescription(serviceNamespace); | |
x.SetDisplayName(serviceNamespace); | |
x.SetServiceName(serviceNamespace); | |
}); | |
} | |
} | |
public interface IService | |
{ | |
void Start(); | |
void Stop(); | |
} | |
public class Service : IService | |
{ | |
public void Start() | |
{ | |
} | |
public void Stop() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment