Program.cs 604 B

12345678910111213141516171819202122232425
  1. using SMP.Message.Consumer;
  2. using Topshelf;
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. HostFactory.Run(x =>
  8. {
  9. x.Service<TaskRunner>(s =>
  10. {
  11. s.ConstructUsing(name => new TaskRunner());
  12. s.WhenStarted(tc => tc.Start());
  13. s.WhenStopped(tc => tc.Stop());
  14. });
  15. x.RunAsLocalSystem();
  16. x.SetDescription("SMP消息服务");
  17. x.SetDisplayName("SMPMessageService");
  18. x.SetServiceName("SMPMessageService");
  19. });
  20. Console.ReadKey();
  21. }
  22. }