标签:
/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main() { HostFactory.Run(c => { c.SetServiceName("LogServices"); c.SetDisplayName("LogServices"); c.SetDescription("LogServices"); c.Service<TopshelfService>(s => { s.ConstructUsing(b => new TopshelfService()); s.WhenStarted(o => o.Start()); s.WhenStopped(o => o.Stop()); }); });
public class TopshelfService { public void Start() { //服务逻辑 } public void Stop() { } }
标签:
原文地址:http://www.cnblogs.com/gossip/p/4506142.html