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 266837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:28:37+00:00 2026-05-11T23:28:37+00:00

I have a Windows Service running on a .Net 2.0 environment (NOT UPGRADABLE TO

  • 0

I have a Windows Service running on a .Net 2.0 environment (NOT UPGRADABLE TO 3/3.5).
The service uses a System.Timers.Timer on a X second Interval to poll for items on a database table.

The Timer.Elapsed event handling code is wrapped around a lock statement to prevent the next Elapsed event of running if the previous processing has not been finished. For each item, Process A is executed and then the item is deleted from the database. This is the current “production” code.

A second process (Process B) needs to be executed, but only for some of the items (which I can easily isolate using a condition) and only after they have been handled by Process A. The resource used to run Process B only accepts one connection at a time. (so having multiple threads for each Process B execution is not an option) If I were to run Process B on my Timer.Elapsed event handling code along with Process A, this would greatly delay the event handler execution and make it more probable that an Elapsed event will not finish to execute in time for the next event, making the system less responsive, etc.

I think it would be best to have a new single thread execute Process B (or another service, which I think would be overkill). Process A would queue items for Process B, so if Process B takes longer than Process A to finish processing items, the next Process A run would just add more items to the Process B queue.

I’m aware using a database as IPC is not exactly a great practice, but given the fact that I can’t use WCF IPC (which would probably have been my approach) AND I’m already using a database here…

Would it be considered a “bad practice” if I keep using the Database as my IPC mechanism and flag the items on the database once Process A finishes so Process B can select and process them (including the delete)? Or should I still try to use some sort of direct IPC between the threads?

It is VERY important that I’m guaranteed that the items in the queue will persist if the system crashes or the services are shut down.

 //This is how my Elapsed event handler should look
    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
       lock(this)
       {
          //Load items from DB
          //foreach item
             //Run Process A
             //if(item.Member == condition)
             //   Queue item for Process B  (DB = reflag,  IPC = send message)
             //If using IPC delete the item from the DB
       }
    }
  • 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-11T23:28:37+00:00Added an answer on May 11, 2026 at 11:28 pm

    On the contrary, using a database as your inter-process communication channel is a terrific practice due to the common requirement you mention at the end of your question:

    It is VERY important that I’m
    guaranteed that the items in the queue
    will persist if the system crashes or
    the services are shut down.

    Just make sure that the flagging happens within the same transactional scope as any other data changes wrought by process A.

    You might even consider breaking this into two services and using a MessageQueue between the logical processes A and B.

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

Sidebar

Related Questions

I have a system service running on my Windows machine that can impersonate the
We have a current WinForm/Windows Service running in .NET 1.1 out on various customer
I have a Windows service running in local system that simply keeps trying to
We are running a .Net 1.1 based Windows Service ( not an ASP.Net application),
I have a Windows Service (written in .NET 1.1) running under a specific user
We have about 7 app servers running .NET windows services that ping a single
I have a WCF service running inside a windows service on a remote machine.
I have a netTcp WCF service running in a windows service on a remote
Let's say I have two windows services running. One service is 'Polling' - it
I have a batch file I'm running from a Windows XP w/service pack 3

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.