示例#1
0
 protected override void OnStop()
 {
     MusService.StopTraces();
     if (serviceHost != null)
     {
         serviceHost.Close();
         serviceHost = null;
     }
 }
示例#2
0
        // Start the Windows service.
        protected override void OnStart(string[] args)
        {
            if (serviceHost != null)
            {
                serviceHost.Close();
            }

            // Create a ServiceHost for the MusService type and
            // provide the base address.
            serviceHost = new ServiceHost(typeof(MusService));

            // Open the ServiceHostBase to create listeners and start
            // listening for messages.
            serviceHost.Open();

            MusService.StartTraces();
        }