question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windsor 5: Idea to deal with PerWebRequest scope in XML

See original GitHub issue

I have an enterprise application that makes use of both XML registration and programmatically convention-based registration. Moving away from XML is not an option. Most component registrations I have in XML use PerWebRequest. Thus, Windsor 5.0 throwed the following error:

[ArgumentException: Requested value 'PerWebRequest' was not found.]
   System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) +1078
   System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) +109
   Castle.MicroKernel.SubSystems.Conversion.EnumConverter.PerformConversion(String value, Type targetType) +44

[ConverterException: Could not convert from 'PerWebRequest' to Castle.Core.LifestyleType.]
   Castle.MicroKernel.SubSystems.Conversion.EnumConverter.PerformConversion(String value, Type targetType) +201
   Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion(String value, Type targetType) +195
   Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion(String value) +41
   Castle.MicroKernel.ModelBuilder.Inspectors.LifestyleModelInspector.ReadLifestyleFromConfiguration(ComponentModel model) +140
   Castle.MicroKernel.ModelBuilder.Inspectors.LifestyleModelInspector.ProcessModel(IKernel kernel, ComponentModel model) +28
   System.Collections.Generic.List`1.ForEach(Action`1 action) +101
   Castle.MicroKernel.ModelBuilder.DefaultComponentModelBuilder.BuildModel(IComponentModelDescriptor[] customContributors) +208
   Castle.MicroKernel.Registration.ComponentRegistration`1.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel) +121
   Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) +72
   Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) +49
   Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter) +692
   Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) +222
   Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope) +152
   Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) +137

Could anyone please suggest a way to deal with this issue? Thanks for reading 😄

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jonorossicommented, Apr 12, 2019

@thuannguy thanks, I’ve merged #483 and made some changes in 02516c5efa07a1e3822d6ba0058f8bcce5856f11. I moved the added section to the System Web facility page so it is all kept together and a few other small changes. Congrats on your first pull request 🎉.

0reactions
jonorossicommented, Apr 12, 2019

@thuannguy definitely a good start. Nothing would have made its way into the docs without you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Castle Windsor 5.0 PerWebRequest Lifestyle
I'm having the same issue; when assigning the PerWebRequest lifestyle via the fluent configuration API everything works fine but when I ...
Read more >
Chapter 10. Castle Windsor - Dependency Injection in .NET
In this section, we'll look at two of Castle Windsor's lifestyles that require more configuration than just a simple declaration: POOLED and PerWebRequest...
Read more >
castle-windsor
When a Component is resolved from the Windsor container it must have a definition of the scope it is in. By scope meaning...
Read more >
Castle – Page 2
As outlined in previous section, Windsor can detect end of scope for components with most lifetimes. In that case, if you have a...
Read more >
Release 3 Simple Injector Contributors
Simple Injector contains five scoped lifestyles: Lifestyle. Description. Disposal. Per Web Request. Only one instance will be created by the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found