コード例 #1
0
        /// <summary>
        /// The service control manager has requested us to start
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
//#if (DEBUG)
//            Debugger.Launch(); //<-- Simple form to debug a web services
//#endif
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptions);
            try
            {
                Common.InitialiseLogFolder();
                DeleteStoreFiles();
            }
            catch (Exception ex)
            {
                logging.AddToLog("Error getting registry settings and/or deleting logs: " + ex.Message, true);
            }

            logging.AddToLog("OnStart", true);

            logging.AddToLog("Removing Orphaned methods", true);
            OSAEMethodManager.ClearMethodQueue();

            Common.CreateComputerObject(sourceName);
            CreateServiceObject();

            // Start the WCF service so messages can be sent
            // and received by the service
            StartWCFService();

            // Start the threads that monitor the plugin
            // updates check the method queue and so on
            StartThreads();
        }
コード例 #2
0
        /// <summary>
        /// The service control manager has requested us to start
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            Log.Debug("OnStart subroutine Starting...");
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptions);

            var dbConnectionStatus = Common.TestConnection();

            if (dbConnectionStatus.Success)
            {
                Log.Info("Verified successful connection to database.");
            }
            else
            {
                Log.Fatal("Unable to connect to database: " + dbConnectionStatus.CaughtException.Message);
                return;
            }

            try
            {
                string externalip = new System.Net.WebClient().DownloadString("https://api.ipify.org");
                OSAEObjectPropertyManager.ObjectPropertySet("SYSTEM", "WAN IP", externalip, "SERVICE");
            }
            catch (Exception ex)
            { Log.Fatal("Error getting registry settings and/or deleting logs: " + ex.Message, ex); }

            try
            {
                Common.InitialiseLogFolder();
                DeleteStoreFiles();
            }
            catch (Exception ex)
            { Log.Fatal("Error getting registry settings and/or deleting logs: " + ex.Message, ex); }

            Log.Info("Removing Orphaned Methods");
            OSAEMethodManager.ClearMethodQueue();

            try
            {
                OSAE.OSAESql.RunSQL("SET GLOBAL event_scheduler = ON;");
            }
            catch (Exception ex)
            { Log.Fatal("Error setting the event scheduler: " + ex.Message, ex); }

            checkLog          = new System.Timers.Timer(60000);
            checkLog.Elapsed += checkLogEvent;
            checkLog.Enabled  = true;

            // Start the network service so messages can be
            // received by the service
            StartNetworkListener();

            // Start the threads that monitor the plugin
            // updates check the method queue and so on
            StartThreads(serviceObject);
        }
コード例 #3
0
        /// <summary>
        /// The service control manager has requested us to start
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptions);

            var dbConnectionStatus = Common.TestConnection();

            if (dbConnectionStatus.Success)
            {
                this.Log.Info("Verified successful connection to database.");
            }
            else
            {
                this.Log.Fatal("Unable to connect to database: " + dbConnectionStatus.CaughtException.Message);
                return;
            }

            try
            {
                Common.InitialiseLogFolder();
                DeleteStoreFiles();
            }
            catch (Exception ex)
            {
                this.Log.Fatal("Error getting registry settings and/or deleting logs: " + ex.Message, ex);
            }

            this.Log.Info("OnStart");

            this.Log.Info("Removing Orphaned Methods");
            OSAEMethodManager.ClearMethodQueue();

            Common.CreateComputerObject(sourceName);
            CreateServiceObject();

            OSAE.OSAESql.RunSQL("SET GLOBAL event_scheduler = ON;");

            checkLog          = new System.Timers.Timer(60000);
            checkLog.Elapsed += checkLogEvent;
            checkLog.Enabled  = true;

            // Start the network service so messages can be
            // received by the service
            StartNetworkListener();


            // Start the threads that monitor the plugin
            // updates check the method queue and so on
            StartThreads();
        }