using Getf.Service.Transfer.Client.WinService; using Getf.Service.Transfer.Client.WinService.Helpers; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.ServiceProcess; using System.Text; namespace Getf.Service.Transfer.Client { public partial class Service1 : ServiceBase { LogHelper _LogHelper; ClientService _ClientService; public Service1() { InitializeComponent(); var path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "log4net.config"); log4net.Config.XmlConfigurator.Configure(new FileInfo(path)); _LogHelper = new LogHelper(); } public void Debug() { OnStart(null); } protected override void OnStart(string[] args) { _LogHelper.Info("启动服务"); _ClientService = new ClientService(); _ClientService.Start(); } protected override void OnStop() { _LogHelper.Debug("结束服务"); _ClientService.Dispose(); } } }