castle PerRequestLifestyle not recognize
- by Herman
Hi all,
New to Castle/Windsor, please bear with me.
I am currently using the framework System.Web.Mvc.Extensibility and in its start up code, it registered HttpContextBase like the following:
container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
What I wanted to do is to change the behavior and change the lifestyle of httpContextBase to be PerWebRequest.
so I have change the code to the following:
container.Register(Component.For<HttpContextBase>().LifeStyle.PerWebRequest.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
However, when I do this, I got the following error:
System.Configuration.ConfigurationErrorsException: Looks like you forgot to
register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
Add '<add name="PerRequestLifestyle"
type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel"
/>' to the <httpModules> section on your web.config
which I did under <system.web> and <system.webServer>, however, I am still getting the same error. Any hints?
Thanks in advance.