22
schangxiang@126.com
2025-08-23 c3984d64e9727d60a2a61682271bd52cc82712b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
    {
 
        /// <summary>
        /// ControlCenterWcf服务
        /// </summary>
        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();
            }
        }
    }
}