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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:27:47+00:00 2026-05-26T23:27:47+00:00

I have created a WCF method that runs an infinite loop, polling every 5

  • 0

I have created a WCF method that runs an infinite loop, polling every 5 minutes. It writes 2 items to cache, the main item I’m retrieving and the LAST_POLLED. This is successfully called on app start of our web site:

//infinite loop
        while (true)
        {
            try
            {
                _cache.RefreshCache();
                WcfCache.SetCache(LAST_POLLED, DateTime.Now);
            }
            catch(Exception ex)
            {
                //logging exception to database
            }

            //essentially polling interval, though dependent on how long it takes to complete task
            Thread.Sleep(Polling_DELAY);
        }

The LAST_POLLED datetime should have the time it was polled. Occasionally, though, it’s storing Jan 1, 0001. I imagine this must be due to the cache disappearing. The app pool for this WCF site is NOT set to Recycle NOR are the worker processes set to shutdown after being idle. This will work for days at a time, but hasn’t worked a full week yet.

  1. Why is this cache getting reset?
  2. Is there a better way to code this? I didn’t want to create a separate windows service for this to keep down the number of projects/apps, but I can.
  • 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-26T23:27:47+00:00Added an answer on May 26, 2026 at 11:27 pm

    This blog post, although not specifically addressing your topic, does have some good information about what might cause your app pool to get recycled.

    http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx

    IIS will itself recycle the entire w3wp.exe process every 29 hours.
    It’ll just outright put a cap in the w3wp.exe process and bring down
    all of the app domains with it.

    It also contains some information that may solve your problem (HostingEnvironment.RegisterObject)

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

Sidebar

Related Questions

I have created an Ajax enabled WCF web service that contains this simple method:
Hi I want to create a WCF service that have login method, which is
We have created a WCF service hosted in a windows service that handles Authentication
I have created a basic WCF service in IIS. I am aware that this
I have a Data Service created using WCF that internally uses nHibernate. This WCF
I created a WCF Webservice method that receives two parameters, string, and return an
I have a wcf method that accepts an object Order as its input and
I created a simple WCF web service that has one method: SubmitTicket(flightticket ft, string
I have created a WCF service that uses windows authentication and would like to
I have created a WCF service for uploading images , which accepts System.IO.Stream as

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.