ningshuxia
2022-12-12 5edc5ddae75f0141626fec624644c1821d4c17a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using Topshelf;
 
namespace IStation.TopShelf  
{
    class Program
    {
        static void Main(string[] args)
        {
            HostFactory.Run(x =>
            {
                x.Service<Service>();
                x.RunAsLocalSystem();
                x.SetDescription("智慧泵站恩普特设备服务");
                x.SetDisplayName("IStation.Server.Expert");
                x.SetServiceName("IStation.Server.Expert");
                x.EnableServiceRecovery(r => r.RestartService(TimeSpan.FromSeconds(120)));
                x.StartAutomatically();
 
            });
            Console.ReadLine();
        }
    }
}