Program.cs 932 B

123456789101112131415161718192021222324252627282930313233343536
  1. using RDIFramework.Utilities;
  2. using System;
  3. using System.Configuration;
  4. using System.IO;
  5. using Topshelf;
  6. namespace TimedUpload
  7. {
  8. class Program
  9. {
  10. private static string ServiceName = ConfigurationManager.AppSettings["ServiceName"];
  11. static void Main(string[] args)
  12. {
  13. log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
  14. try
  15. {
  16. HostFactory.Run(x =>
  17. {
  18. x.UseLog4Net();
  19. x.Service<ServiceRunner>();
  20. x.SetDescription(ServiceName);
  21. x.SetDisplayName(ServiceName);
  22. x.SetServiceName(ServiceName);
  23. x.EnablePauseAndContinue();
  24. });
  25. }
  26. catch (Exception ex)
  27. {
  28. }
  29. }
  30. }
  31. }