Thanks to this discussion. I understand it clearer. I actually wrote a blog 
post that explains the issue in a code-level by decompiling the 
Castle.Windsor.dll. 

Fixed and Explained: Forgot to register the http module 
Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, here 
<https://sitecorelogy.com/2016/05/25/fixed-sitecore-forgot-to-register-the-http-module-castle-microkernel-lifestyle-perwebrequestlifestylemodule/>
.

On Thursday, 1 October 2009 00:00:44 UTC+8, Marnix 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. 
> (see 
> http://blog.alanta.nl/2009/07/castle-perwebrequestlifestyle-wont-work.html) 
>
>
> Does anybody know of a better way to handle the application-startup 
> and unit-testing scenario's with PerWebRequestLifeStyle? 
>
> Thanks, 
> Marnix 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to