using iWareOpc.Wcf; 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.Tasks; namespace iWareOpc { public partial class Service1 : ServiceBase { /// /// ControlCenterWcf服务 /// private ServiceHost OpcWcfHost = null; public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { OpcWcfHost = new ServiceHost(typeof(OpcWcfService)); OpcWcfHost.Open(); } protected override void OnStop() { if (OpcWcfHost != null) { OpcWcfHost.Close(); } } } }