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

  • Home
  • SEARCH
  • 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 9194235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:21:40+00:00 2026-06-17T21:21:40+00:00

I am trying to use the Cache facilities of Service Stack. These are accessed

  • 0

I am trying to use the Cache facilities of Service Stack. These are accessed through the
RequestContext, which is injected by the IOC in your Service.

This works as expected if you are using the default Funq IOC, it does not work when you hook AutoFac, RequestContext is null and I am not sure how to configure autofac to build it. Any clues here? My AutoFac configuration:

var builder = new ContainerBuilder();

//Now register all dependencies to your custom IoC container

builder.RegisterAssemblyTypes(new[] { typeof(AppHost).Assembly })
       .PropertiesAutowired(PropertyWiringFlags.AllowCircularDependencies)
       .AsImplementedInterfaces()
       .SingleInstance();

container.Register<ICacheClient>(new MemoryCacheClient());

IContainerAdapter adapter = new AutofacIocAdapter(builder.Build());
container.Adapter = adapter;

EDIT:

My Service already extends ServiceStack.ServiceInterface.Service:

public class UserDetailsService : ServiceStack.ServiceInterface.Service

which implements IRequiresRequestContext, RequestContext is null. If I remove autofac then it works as expected. With Autofac RequestContext is null

  • 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-17T21:21:41+00:00Added an answer on June 17, 2026 at 9:21 pm

    RequestContext is not meant to be injected by an IOC, it’s a special property that is set by ServiceStack if your Service requests it by implementing the IRequiresRequestContext interface. E.g.

    public class MyClass : IService, IRequiresRequestContext {
        //injected by ServiceStack at run-time (per request)
        public IRequestContext RequestContext { get; set; } 
    }
    

    This is the same mechanism how the RequestContext property gets populated in the convenient default Service base class in ServiceStack.

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

Sidebar

Related Questions

I'm trying to cache a profile user page. For this, I use : $response
I'm trying to use the cache driver which CodeIgniter supplies in their PHP framework.
I'm trying to use Seq.cache with a function that I made that returns a
I'm trying to use WindowsAzure shared cache and the Increment operator of the DataCache
im trying to orient my code to use the cache as efficiently as possible
I am trying to use action caching to cache an action and then manually
I'm trying to use beaker cache with SQLAlchemy but I've been receiving errors. Here
I am trying to use xcache with zend framework to cache the metadata from
I am trying to use a plugin for a dropdown which takes in JSON
I'm trying to use Reducisaurus Web Service to minify CSS and Javascript but I've

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.