You must Sign In to post a response.
  • Category: .NET

    How to ignore already running task in Windows Service running at 3 Minute Interval

    Hi ,

    I have created an windows service which is running at every 3 minute interval on which i am doing some data manipulation task, suppose a task is taking more than 3 minutes and service restarts again then the already going on task stopped and starts again. is there any way to ignore the already going task.

    Kindly share some examples.

    thanks
    vinay
  • #769867
    Hi Vinay,

    When your service gets started that time you can check if your task in progress by capturing status from sql status or any application is running.

    You can refer below code:
    foreach (var process in Process.GetProcessesByName("applicationName"))
    {
    process.Kill();
    }

    I hope this is what you are looking for.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


  • Sign In to post your comments