I agree with you... as I was saying the only way to properly handle
> I think the problem is that you are trying to _resolve_ a component
> with pwr lifestyle from the container at application startup. Why do
> you need to do that? I am using the PWR lifestyle successfully since I
> am resolving components not earlier than the BeginRequest step, when
> the http modules are already initialized.
> On Sep 30, 6:00 pm, Marnix <mar...@alanta.nl> wrote:
> > Hi,
> > If noticed that services with the PerWebRequestLifeStyle will not work
> > during initialization of the ASP.NET application. The problem is that
> > the PerWebRequestLifeStyle relies on an HttpModule which is not
> > initialized yet during the Application_Start event or at the time the
> > Application.Init method is invoked.
> > The result is a very descriptive (but incorrect) error message:
> > Looks like you forgot to register the http module
> > Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule. [..]
> > In addition to this the PerWebRequestLifeStyle breaks down during unit
> > testing outside ASP.NET with the same exception.
> > I realize that this lifestyle was not intended to be used outside of
> > requests but it would be nice if this was handled more gracefully.
> > I've blogged about the workaround I'm currently using which is to fall
> > back to TransientLifeStyle during application startup and when there
> > is no web context.
> > (seehttp://blog.alanta.nl/2009/07/castle-perwebrequestlifestyle-wont-work...)
> > Does anybody know of a better way to handle the application-startup
> > and unit-testing scenario's with PerWebRequestLifeStyle?
> > Thanks,
> > Marnix