Beispiel #1
0
        protected override void OnStop()
        {
            LoggerAgent.Debug("Stopping service...");

            GC.Collect();
            Thread.Sleep(2000);

            if (rdr != null)
            {
                string ver = rdr.GetVersion();
                LoggerAgent.Debug("OnStop : Local service object call to before dispose. -- GetVersion : " + ver);

                rdr = null;
            }
            else
            {
                LoggerAgent.Debug("OnStop : Reader service is NULL");
            }

            if (host != null)
            {
                LoggerAgent.Debug("OnStop : host object is getting disposed.");
                host.Close();
                host = null;
            }
            else
            {
                LoggerAgent.Debug("OnStop : host object is NULL");
            }
        }
Beispiel #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            #if Debug
              GC.Collect();
            Thread.Sleep(5000);
            // With this it work
            ReaderService rdr = new ReaderService();

            Thread.Sleep(5000);
            ServiceHost host = new ServiceHost(rdr);
            host.Open();
            while (true)
            {
                Thread.Sleep(5000);
                GC.Collect();
            }
            host.Close();
            #else

            LoggerAgent.Debug("Creating Service to run...");

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new SystricsWinReaderService()
            };

            LoggerAgent.Debug("Service about to run...");
            ServiceBase.Run(ServicesToRun);
            #endif
        }
Beispiel #3
0
        protected override void OnStart(string[] args)
        {
            LoggerAgent.Debug("Starting service...");

            GC.Collect();
            Thread.Sleep(2000);

            LoggerAgent.Debug("Creating reader service instance...");
            rdr = new ReaderService();

            try
            {
                host = new ServiceHost(rdr);
                host.Open();
            }
            catch (Exception ex)
            {
                LoggerAgent.Error("Failed to host service.", ex);
            }

            string ver = rdr.GetVersion();
            LoggerAgent.Debug("OnStart : Local service object call to -- GetVersion : " + ver);
        }