You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
892 B
38 lines
892 B
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Diagnostics;
|
||
|
using System.Linq;
|
||
|
using System.ServiceProcess;
|
||
|
using System.Text;
|
||
|
using QMTask.Core;
|
||
|
using System.Configuration;
|
||
|
|
||
|
namespace QMTask.WindowService
|
||
|
{
|
||
|
public partial class HostService : ServiceBase
|
||
|
{
|
||
|
private TaskServer _server = new TaskServer();
|
||
|
|
||
|
public HostService()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
protected override void OnStart(string[] args)
|
||
|
{
|
||
|
TaskService.MyTaskServer = _server;
|
||
|
//指定服务凭据
|
||
|
TaskService.ServiceCredentialID = ConfigurationManager.AppSettings["ServiceCredentialID"];
|
||
|
|
||
|
_server.StartService();
|
||
|
}
|
||
|
|
||
|
protected override void OnStop()
|
||
|
{
|
||
|
_server.StopService();
|
||
|
}
|
||
|
}
|
||
|
}
|