Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PerWebRequestLifeStyle won’t work from Application_Start
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marnix  
View profile  
 More options Sep 30 2009, 12:00 pm
From: Marnix <mar...@alanta.nl>
Date: Wed, 30 Sep 2009 09:00:44 -0700 (PDT)
Local: Wed, Sep 30 2009 12:00 pm
Subject: PerWebRequestLifeStyle won’t work from Application_Start
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...)

Does anybody know of a better way to handle the application-startup
and unit-testing scenario's with PerWebRequestLifeStyle?

Thanks,
Marnix


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mauricio Scheffer  
View profile  
 More options Oct 1 2009, 10:48 pm
From: Mauricio Scheffer <mauricioschef...@gmail.com>
Date: Thu, 1 Oct 2009 19:48:32 -0700 (PDT)
Local: Thurs, Oct 1 2009 10:48 pm
Subject: Re: PerWebRequestLifeStyle won’t work from Application_Start
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marnix  
View profile  
 More options Oct 7 2009, 11:46 am
From: Marnix <mar...@alanta.nl>
Date: Wed, 7 Oct 2009 08:46:08 -0700 (PDT)
Local: Wed, Oct 7 2009 11:46 am
Subject: Re: PerWebRequestLifeStyle won’t work from Application_Start
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SimoneB  
View profile  
 More options Oct 8 2009, 5:46 am
From: SimoneB <simone.bus...@gmail.com>
Date: Thu, 8 Oct 2009 02:46:54 -0700 (PDT)
Local: Thurs, Oct 8 2009 5:46 am
Subject: Re: PerWebRequestLifeStyle won’t work from Application_Start
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mauricio Scheffer  
View profile  
 More options Oct 8 2009, 8:21 am
From: Mauricio Scheffer <mauricioschef...@gmail.com>
Date: Thu, 8 Oct 2009 05:21:23 -0700 (PDT)
Local: Thurs, Oct 8 2009 8:21 am
Subject: Re: PerWebRequestLifeStyle won’t work from Application_Start
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »