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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:48:37+00:00 2026-05-30T04:48:37+00:00

I often find when I’m writing a service class (within an ASP.NET app) that

  • 0

I often find when I’m writing a service class (within an ASP.NET app) that in addition to the usual method calls, I’d like scheduled method calls which invoke, say, every day at 1am.

My idea is to create a custom attribute which would be used against any scheduled task methods:

[ScheduledTask(Every=TimeSpans.Day, At=6)]
public static void Cleanup()
{
    // some clean up code here
}

In order to implement this, I would have to scan the assemblies loaded in the AppDomain at the web app’s Application_Start method. Look for static methods with the ScheduledTask attribute and then invoke the scheduler to run these methods according to the attribute.

I’ve looked around the net and found that no-one else seems to have done this and wondered whether this is generally a bad idea for some reason!? Would it be possible do you think?

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-05-30T04:48:39+00:00Added an answer on May 30, 2026 at 4:48 am

    Some problems I see:

    • Separation of concerns. Your class provides the Cleanup implementation and the schedule to run it. An administrator is likely to want to control the schedule (e.g. run Cleanup at times of low activity), so it’s more common to use configuration to provide a schedule.

    • Difficult for an administrator to get an overview of what tasks are scheduled.

    • Interpretation of the schedule. Is your example 6 UTC or local time?

    • Ease of modification of the schedule – you need to recompile.

    • ASP.NET applications can shut down, e.g. after a period of inactivity, or on a predefined schedule, and won’t start up again until another request arrives. Which makes IIS a poor host for running scheduled tasks.

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

Sidebar

Related Questions

I often find that in writing tests for a method I want to throw
I often find myself writing a property that is evaluated lazily. Something like: if
I often find I am writing a class similar to the following (but with
I often find myself remembering the name of a class that I want to
I often find myself writing R scripts that generate a lot of output. I
I often find I have class instances that are descendants of other class instances,
I often find myself writing class constructors like this: class foo: def __init__(self, arg1,
I often find myself asserting that an object isKindOfClass of some class in Objective-C.
I often find the need to do something along these lines: public class OperationResult
I often find myself wanting to debug CSS layout issues that involve DOM changes

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.