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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:57:15+00:00 2026-06-15T10:57:15+00:00

For example, I want to call a function in specific time intervals (hourly or

  • 0

For example, I want to call a function in specific time intervals (hourly or daily tasks.)

I m already using Timer. But it is working as long as my local server is working. For Example:

public static void StartYahooWeatherManager()
{
    Timer t = new Timer(1000 * 60 * 60 * 6  /* 6 hours */);
    t.Elapsed += new ElapsedEventHandler(WriteYahoWeatherRssItemToDb);
    t.Start();
}

private static void WriteYahoWeatherRssItemToDb(object o, ElapsedEventArgs e)
{
    YahooWeatherManager.InsertYahooWeatherRssItem(YahooWeatherManager.GetYahooWeatherRssItem());
}

I write weather info to db, in 6 hour intervals. Project is already in Host. Timer event is working as long as my computer local server is running.

Question:

What is the wrong about my code? (Or logical wrong to using timer in WebProject?) Why timer is only working while local server working?

What is the best way to manage time interval tasks? (not need asp.net)

I hope, I can explain the problem. Thanks.

  • 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-15T10:57:16+00:00Added an answer on June 15, 2026 at 10:57 am

    The reason why the timer stops is because this timer runs in your ASP.NET application which itself is hosted on a web server. When this server stops or recycles the application, the AppDomain is brought down along with all threads you might have started. That’s why it is a very bad idea to write repeating background tasks in an ASP.NET application. Phil Haack blogged about the dangers.

    The correct way to do this is to host this code in a separate process outside of your ASP.NET application. This could be a windows service or a console application which is scheduled to run at regular intervals using for example the Windows scheduler. This way the code is guaranteed to always run.

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

Sidebar

Related Questions

I want to create a simple menu function which can call it example get_menu()
I want to delay the execution of jQuery script for specific time. For example,
I am working in C# I want to be able to call a function
I want to call dynamic tag in my custom tag . for example <mytag:taga
I have created a separate class (let's call it class2.cs for example) and want
I want to return multiple values from a PHP function, but it did not
I want to call a specific operator of specific base class of some class.
I have a javascript file and I want to call a function on the
For example I want to use custom logger: logger = require('basic-logger'), logger.setLevel('info') var customConfig
For example: I want to know if there are images in a directory (eg.

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.