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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:47:25+00:00 2026-06-05T02:47:25+00:00

I have a simple Azure Worker role running that performs a task every day

  • 0

I have a simple Azure Worker role running that performs a task every day at 12 PM. Below is the code that accomplishes this.

public override void Run()
{
    try
    {
        while (true)
        {
              int time = Convert.ToInt32(DateTime.Now.TimeOfDay);
              if (time == 12)
              {
                   DoSomethingElse();
              }
        }

    }
    catch (Exception ex)
    {
        Log.Add(ex, true);
    }            
}

Here DoSomethingElse() is a method to send an email at every day 12 PM, and also fires once and only once per day.

How can I implement a scheduler that fire when the time is 12PM and execute DoSomethingElse().

My question is: Is this (above code) is the best method or use any 3rd party tool.

  • 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-06-05T02:47:26+00:00Added an answer on June 5, 2026 at 2:47 am

    There are several other questions here that deal with this (and I’ve marked one above). Having said that, and at the risk of repeating what other answers already state:

    In your case, a simple message on a Windows Azure Queue, time-delayed to not show up until noon, would work. This also helps deal with multi-instance scenarios: If you’re running two instances of your role, you don’t want the same scheduled task running twice, so you need a way to have only one of those instances execute this code. This is easily handled via queue message, or you could run scheduler code on a single instance by using something like a blob lease (which may only have one write-lock against it) as a mutex. This is covered in @smarx’s blog post, here.

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

Sidebar

Related Questions

I have a simple work role in azure that does some data processing on
I have a fairly simple WCF Role on Azure that I am trying to
I've uploaded a simple Azure website (am testing out authentication) and have found this:
I have an MVC web app running in azure that serves up large files
In my Azure role I have a lot of entities that have to be
I have one worker role that throws data into around 10 queues that need
I have an Azure web role that accesses an external WCF based SOAP web
I have simple win service, that executes few tasks periodically. How should I pass
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have simple WinForms application where modifying Windows Registry. The problem is that 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.