Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6950255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:04:14+00:00 2026-05-27T14:04:14+00:00

hi i am working on c# window services, for that i have set some

  • 0

hi i am working on c# window services, for that i have set some timer code in onstart method as below code i have pasted it:

protected override void OnStart(string[] args)
{
    timerjob.Elapsed += new ElapsedEventHandler(CsvGenFromDatabase);
    // ad 2: set interval to 1 minute (= 60,000 milliseconds)
    timerjob.Interval = Convert.ToDouble(DueTime);
    //  ////ad 3: enabling the timer
    timerjob.Enabled = true;
}

CsvGenFromDatabase is my method which will so my service, here my problem is i have set a timer (duetime) about 1 min for example if i tested simple volume job means it was performing good, if suppose if i given a huge volume of work for service to do when timer (duetime) was same 1 min at this scenario i m facing some error because still service work does not completed full but time 1 min passed away since service will poll new instance past work was not completed fully, for this scenario how do i handle to my service with out effecting any work when service was in one instance,kindly can any on give suggesions please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:04:14+00:00Added an answer on May 27, 2026 at 2:04 pm

    In your CsvGenFromDatabase method you could call timerjob.Stop() before your long running process. Once the process has complete you can call timerjob.Start() to start the timer again.

    Example:

    private void CsvGenFromDatabase()
    {
        timerjob.Stop();
    
        //long running process
    
        timerjob.Start();
    }
    

    I’m assuming timerjob is available globally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows service that has a timer that fires a method every
I have modified a working Windows service that had always been starting beforehand. After
I'm working on a Windows Service that's having some issues with Thread.Sleep() so I
I have the follwing code (which is not working): private void Window_PreviewKeyDown(object sender, KeyEventArgs
I have been trying to set-up my recently reimaged workstation for working with one
I have a set of Win32 applications that share information using a shared memory
i have my application skeleton working as expected - it might be that somebody
I'm working on a project that is composed of a few windows services that
I have this problem where a system contains nodes (windows services) that push messages
I've been working on a set of RESTful HTTP services implemented using Restlet in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.