using SmartCamp.TaskServer.Topshelf; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Topshelf; namespace SmartCamp.TaskServer { class Program { static void Main(string[] args) { //注册log4net string path = System.AppDomain.CurrentDomain.BaseDirectory + "log4net.config"; //Utility.Log4net.LogManager.InitLog4Net(path); HostFactory.Run(x => { x.Service(); x.SetServiceName(ServiceConfig.Default.ServiceName); x.SetDisplayName(ServiceConfig.Default.ServiceDisplayName); x.SetDescription(ServiceConfig.Default.ServiceDescription); x.RunAsLocalSystem(); x.EnablePauseAndContinue(); x.EnableShutdown(); }); } } }