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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:51:44+00:00 2026-05-15T02:51:44+00:00

I would like to use output caching with WCF Data Services and although there’s

  • 0

I would like to use output caching with WCF Data Services and although there’s nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms.

But I am worried about the worker process getting recycled due to excessive memory consumption if large responses are cached. Is there a way to specify an upper limit for the ASP.NET output cache so that if this limit is exceeded, items in the cache will be discarded?

I’ve seen the caching configuration settings but I get the impression from the documentation that this is for explicit caching via the Cache object since there is a separate outputCacheSettings which has no memory-related attributes.

Here’s a code snippet from Scott Hanselman’s post that shows how I’m setting the cacheability of the request.

protected override void OnStartProcessingRequest(ProcessRequestArgs args)
{
    base.OnStartProcessingRequest(args);
    //Cache for a minute based on querystring
    HttpContext context = HttpContext.Current;
    HttpCachePolicy c = HttpContext.Current.Response.Cache;
    c.SetCacheability(HttpCacheability.ServerAndPrivate);
    c.SetExpires(HttpContext.Current.Timestamp.AddSeconds(60));
    c.VaryByHeaders["Accept"] = true;
    c.VaryByHeaders["Accept-Charset"] = true;
    c.VaryByHeaders["Accept-Encoding"] = true;
    c.VaryByParams["*"] = true;
}
  • 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-15T02:51:46+00:00Added an answer on May 15, 2026 at 2:51 am

    Ahh! I feel dumb now… It appears I can set this limit in IIS’s configuration, which makes sense since I guess IIS is providing the output caching services to ASP.NET in the first place.

    And as an added bonus it seems IIS has already defaulted to some reasonable settings for this:

    Maximum cached response size (in bytes) Specifies the maximum size of
    a cached response for both the
    user-mode and kernel-mode caches. The
    default value is 262144 bytes. This
    field is enabled at the server level
    only; it is read-only at all other
    levels.

    Cache size limit (in MB) Configures the size limit of both the
    user-mode and kernel-mode caches. You
    can type a size (in MB) or type 0. If
    you type 0, IIS uses half of the
    available physical memory or virtual
    memory, whichever is less. This field
    is enabled at the server level only;
    it is read-only at all other levels.

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

Sidebar

Related Questions

I would like to use azure caching to store session and output caching data.
I would like to use the output caching function in CodeIgniter, it is simple
I have a user control which I would like to use output caching on,
I would like to use abcPDF (.net) generator to output a stream of data
I'm using the gem datagrid to display some data. I would like to use
I would like to use a Groovy closure to process data coming from a
I would like to use PHP to input a certain text and the output
I would like to use a TypeCoverter to regionalise output for enums in an
I like to use ascii output of my results. There is always an extra
I would like to use linq to group the data using value and to

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.