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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:31:47+00:00 2026-06-13T23:31:47+00:00

I would like my web service to call a clean up routine every X

  • 0

I would like my web service to call a clean up routine every X hours, with no input from any user, or any call to “Start Clean up Services”. I understand I can call a method to start this service, but I want no user interaction at all. I want to publish this service, and it automatically starts, and runs my clean up process every X hours.

Any ideas?

  • 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-13T23:31:48+00:00Added an answer on June 13, 2026 at 11:31 pm

    You can setup a timer in the Global.asax.cs file that’ll go off every X hours, or you could also create a scheduled tasks that goes off every X hours as well to trigger the clean up service.

    If you do not have a Global file in the project you can simply add one by adding one to the project. To do this right-click on the project -> Add -> New Item, and then in the dialog that pops up in select Global Application Class and hit Add. Then inside the Application_Start event you can initialize your timer to perform the action.

    public class Global : System.Web.HttpApplication
    {
        private static System.Threading.Timer timer;
    
        protected void Application_Start(object sender, EventArgs e)
        {
            var howLongTillTimerFirstGoesInMilliseconds = 1000;
            var intervalBetweenTimerEventsInMilliseconds = 2000;
            Global.timer = new Timer(
                (s) => SomeFunc(),
                null, // if you need to provide state to the function specify it here
                howLongTillTimerFirstGoesInMilliseconds,
                intervalBetweenTimerEventsInMilliseconds
            );
        }
    
        private void SomeFunc()
        {
            // reoccurring task code
        }
    
        protected void Application_End(object sender, EventArgs e)
        {
            if(Global.timer != null)
                Global.timer.Dispose();
        }
    }
    

    For more information on the Global file you may want to refer to MSDN

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

Sidebar

Related Questions

I have a web service method where I would like to throw some custom
Here is what I would like to achieve: I have a web service A
I've written an ASP.NET web service that I would like a .NET 3.x application
I have a web site and a web service and I would like to
I have a xml web service which I would like to track using Google
We are developing a web service in .Net, and our client would like the
I'm using Jetty (version 6.1.22) to service a Java web application. I would like
I would like to return an array of string in my web services I've
I would like to make web service which will delete post asynchronusly. I am
I am designing a web service which will call different external web services according

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.