/// <summary>
        /// Stop Service
        /// </summary>
        protected override void OnStop()
        {
            try {
                if (device != null)
                {
                    device.StopService();
                    device = null;
                }
                EventLog.WriteEntry("Shiol Service Stopped", EventLogEntryType.Information);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Shiol Service Stopped ERR. " + e.Message, EventLogEntryType.Error);
            }

            try
            {
                if (serviceHost != null)
                {
                    serviceHost.StopService();
                }
                EventLog.WriteEntry("Web Service Stopped", EventLogEntryType.Information);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Web Service Stopped ERR. " + e.Message, EventLogEntryType.Error);
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            WebServerServiceProvider server = new WebServerServiceProvider();

            server.StartService();
            Console.ReadKey();
            server.StopService();
        }