using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using siemensSapService.orm;
namespace siemensSapService
{
public partial class Service1 : ServiceBase
{
#region 开启服务流程
//1.cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
//2.InstallUtil.exe E:\ximenzi\wms\siemensSapService\siemensSapService\bin\Debug\siemensSapService.exe 找到自己的服务地址
//启动服务 net start IWareCC
//停止服务 net stop IWareCC
//卸载服务 sc delete IWareCC
#endregion
public Service1()
{
InitializeComponent();
}
ServiceHost aspService;//声明WCF变量
protected override void OnStart(string[] args)
{
aspService = new ServiceHost(typeof(siemensSapService.wcf.sapWcf));
aspService.Open();//开启wcf服务
}
protected override void OnStop()
{
CloseWcf(aspService);//关闭WCF服务
}
///
///关闭WCF
///
///需要关闭的WCF
private void CloseWcf(ServiceHost host)
{
if (host != null)
{
host.Close();
}
}
///
/// 关闭线程
///
/// 需要关闭的线程
private void CloseThread(Thread thread)
{
if (thread != null)
{
thread.Abort();
}
}
}
}