Beispiel #1
0
        /// <summary>启动</summary>
        private static MgmtServiceBootstrapper Start(HostSettings settings)
        {
            var bootstrapper = new MgmtServiceBootstrapper();

            bootstrapper.Initialize();
            return(bootstrapper);
        }
Beispiel #2
0
 /// <summary>入口</summary>
 static void Run()
 {
     HostFactory.Run(x =>
     {
         x.Service <MgmtServiceBootstrapper>(sc =>
         {
             sc.ConstructUsing(Start);
             sc.WhenStarted(tc => tc.Start());
             sc.WhenStopped(tc => tc.Stop());
         });
         x.UseNLog();
         x.OnException(ex => MgmtServiceBootstrapper.Error("Topshelf:", ex));
         x.RunAsLocalSystem();
         x.StartAutomaticallyDelayed();
         x.SetServiceName(PKSWebConsts.MgmtServicesHost);
         x.SetDisplayName("PKS管理服务宿主");
         x.SetDescription("PKS Management Services Host");
     });
 }