Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Windows Service : ElapsedEventHandler not fire from server

$
0
0

hi all,

i developed a windows service(.Net 4.0), I want to run this service at every one minute so, i wrote the code like below

 protected override void OnStart(string[] args)
        {
            try
            {

             timer = new Timer();
                timer.Start();
                timer.AutoReset = true;
                timer.Enabled = true;
                timer.Interval = 60000;// 1 Minute

timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);

     }

           catch (Exception oEX)
            {
                WriteLog(oEX.Message);
            }

     }

 private void StartTimer()
        {

timer.Start();

}

 private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            try
            {

WriteLog(" before call report form");

.................

............

}

}

configured in my laptop(Windows 8). its working fine.

Next, the same i published on Windows 2000 server, there its installed and start running but, its not firing private void OnElapsedTime(object source, ElapsedEventArgs e) event so, none of my code ran inside of this event.

Experts may i know why its not working? and how do i resolve this problem? Please guide me.


Thanks In Advance, Jeyaseelan


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>