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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:56:46+00:00 2026-05-13T22:56:46+00:00

I have an ASP.NET application running on multiple IIS6 web servers, with a SQL

  • 0

I have an ASP.NET application running on multiple IIS6 web servers, with a SQL Server 2005 database back-end.

I need to:

  1. monitor the database for the completion of an external job event, and then

  2. have exactly one web application instance submit some information to a web service

For (1) it seems like a SqlDependency would be the best approach (or just plain old polling). Each web application instance would register such a dependency when it starts up. (I don’t want to configure a ‘master’ instance because the failure of that instance would mean the task doesn’t proceed, even if other instances are available. Thus my design is to ensure that if there is an instance available to do the work, then the work ought to proceed.)

For (2) I have been thinking of having some sort of flag in the database that the web application instances try to update once they receive the SqlDependency notification in (1), along the following line (greatly simplified):

UPDATE StatusTable SET TaskStatus = 1 WHERE TaskStatus = 0

SELECT @@ROWCOUNT

The idea is that only one application instance would have been able to update the TaskStatus, and thus only one instance would have a @@ROWCOUNT > 0. This would then be the instance ‘elected’ to submit the information to the web service.

What are the deficiencies with this approach? What are my other options? (Note: a separate service doing this work is not an option.)

  • 1 1 Answer
  • 4 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-13T22:56:47+00:00Added an answer on May 13, 2026 at 10:56 pm

    A global ‘flag’ will not work, keep in mind that you have multiple waiters and multiple notifications, you don’t want one ‘waiter’ to pick up all notifications. To reliable pick ‘exactly one’ task, use UPDATE with OUTPUT:

    UPDATE TOP(1) StatusTable
       SET Status = 1
    OUTPUT DELETED.TaskId
    WHERE Status = 0;
    

    This is the recommended, reliable, way to dequeue rows from tables used as queues, see the Queues paragraph in OUTPUT Clause.

    But by now you should realize that 1) you are using tables as queues 2) you are receiving notifications from these queues and 3) you use Service Broker to deliver these notifications (via SqlDependency, which internally uses Service Broker). So why not use just plain Service Broker? You need a queue and a service and have each instance starts a WAITFOR(RECEIVE…) on this queue (which is not polling). The job of interest ends its work with a SEND to your service, notifying that a job is complete. Exactly one of your instances will pick up this notification and carry on the post-processing (ie. deliver the web service call). This way you cut out all the ‘fluf’ around the notifications (SqlDependency, global flag, tables used as queues) and you go against the bare-bone infrastructure which would be used by SqlDependency anyway.

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

Sidebar

Related Questions

I have a ASP.NET web application running on an IIS6 server. The application is
I have an ASP.NET 2.0 web application running on a shared server of a
I have a SQL Server as backend for an asp.net application. Multiple people might
We have a single ASP .NET application running on a single web server (no
we have an ASP.net web application running on IIS7. We have multiple users, but
I have one ASP.NET web application running at the web server root which provides
Suppose I have an ASP.NET application running across several web servers behind a load
I have an ASP.Net web application running on an IIS server, and I need
We have a asp.net 2.0 web application that is running on IIS7. It is
I have migrated one ASP.NET v4.0 application to a new server running under a

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.