transient lifestyle manager, similar to the one you posted... kinda
On Sep 30, 1: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.