Re: PerWebRequestLifeStyle won’t work from Application_Start

2016-05-24 Thread hammett
No need to decompile it. The code is right here:
https://github.com/castleproject/Windsor/blob/master/src/Castle.Windsor/MicroKernel/Lifestyle/PerWebRequestLifestyleModule.cs

On Tue, May 24, 2016 at 9:15 PM, Marvin Glenn Lacuna
 wrote:
> 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.
>
> 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.



-- 
Cheers,
hammett
http://www.d-collab.com/
http://www.hammettblog.com/

-- 
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.


Re: PerWebRequestLifeStyle won’t work from Application_Start

2016-05-24 Thread Marvin Glenn Lacuna
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 

.

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.


Re: PerWebRequestLifeStyle won’t work from Application_Start

2009-10-08 Thread SimoneB

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
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: PerWebRequestLifeStyle won’t work from Application_Start

2009-10-08 Thread Mauricio Scheffer

I agree with you... as I was saying the only way to properly handle
this would be using a hybrid request-
transient lifestyle manager, so in fact in AppStart no HttpContext
would be used.
In fact, that's what Marnix does in his blog post.

On Oct 8, 6:46 am, SimoneB simone.bus...@gmail.com wrote:
 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
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: PerWebRequestLifeStyle won’t work from Application_Start

2009-10-07 Thread Marnix

I've entered the issue as a bug; an exception with the wrong error
message is generated. I'd say that's a bug.

http://support.castleproject.org/projects/IOC/issues/view/IOC-ISSUE-166


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: PerWebRequestLifeStyle won’t work from Application_Start

2009-10-01 Thread Mauricio Scheffer

I think the right way to handle this would be with a hybrid request-
transient lifestyle manager, similar to the one you posted...  kinda
like activerecord's HybridWebThreadScopeInfo...

Would you create an enhancement request in the issue tracker?
http://support.castleproject.org/projects/IOC

Please link back to this thread.

Thanks

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.
 (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
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---