Hi, I am seeing some strange behaviour in my web application when using the PerWebRequest lifestyle in that very occasionally I see two instances of a PerWebRequest component created during a single web request. It doesn't happen often and I cannot find a way to consistently recreate it but it definitely happens and it is critically important to me that it doesn't happen.
I was wandering whether it was in any way related to asp.net thread switching as described here http://piers7.blogspot.com/2005/11/threadstatic-callcontext-and_02.html I know that the PerWebRequest lifestyle works by storing things in HttpContext.Currrent.Items and therefore should be safe, but I notice that the currentCreationContext inside DefaultKernel is ThreadStatic which is not safe. Just not sure whether it matters. I have hooked into the ComponentCreated and ComponentDestroyed events in the kernel and can see that in the rare error scenario I can clearly see two instances of my PerWebRequest object being created and then both instances being destroyed all in the same web request. Any ideas are very welcome as I really need to be able to trust this mechanism 100%. Thanks, Julian Jelfs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
