Question Service not running?

cboshdave

Member
Joined
Dec 11, 2014
Messages
24
Programming Experience
1-3
Clearly, this is my first service. We have an app that keeps going down. It has 3 java instances that are running. I want to check every 5 minutes to see if the 3 instances are in the task manager. I wrote it as an app, and it worked fine. Then, converted to a service.

In my Onstart(string[] args) section, I have the following code.
Code:
       protected override void OnStart(string[] args)        
       {
            timer1.Enabled = true;
            DateTime dtNow = DateTime.Now;
            sendText("Service is started - " + dtNow.ToString(), "ICES Service is started.  ");
        }
I actually get the text on my phone. But the the timer1.Enabled does not seem to work. The timer1_Tick even does not seem to ever fire. So, my service starts, but does nothing?

Any suggestions would be helpful.

My Tick code is also here for reference. The sendText() routine never fires.
Code:
        private void timer1_Tick(object sender, EventArgs e)        
        {
            Debugger.Break();
            DateTime dtNow = DateTime.Now;
            sendText("Calling the checker... - " + dtNow.ToString(), "Made the call to the checker.");
            checkTaskManager("Java");
        }
 
Top Bottom