Problem to register type in IoC with LifestylePerWebRequest scope
See original GitHub issueAbp 10.3.0
Hi,
When I try register a object in my module in MVC web with LifestylePerWebRequest, a exception is throw:
Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
To fix this add
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
to the <httpModules> section on your web.config.
Windsor also detected you're running IIS in Integrated Pipeline mode. This means that you also need to add the module to the <modules> section under <system.webServer>.
Alternatively make sure you have Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 assembly in your GAC (it is installed by ASP.NET MVC3 or WebMatrix) and Windsor will be able to register the module automatically without having to add anything to the config file.
I put correct configuration in modules section in web.config, but don’t works anyway:
<system.webServer>
<!--configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString-->
<security>
<requestFiltering>
<requestLimits maxQueryString="5000" maxUrl="1000" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
</modules>
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to register services in scoped lifestyle behaving like ...
This code executes on every web request var container = IoCResolverFactory.GetContainer(); scope = container.BeginScope(); // the request ...
Read more >Wiring HttpControllerContext With Castle Windsor - ploeh blog
The overall solution should still adhere to the Register Resolve Release pattern, so registering a captured HttpControllerContext is a no-go.
Read more >WindsorContainer not releasing transient components ...
I'm using Windsor as IoC through the public sealed class WindsorContainerAdapter : IContainerAdapter, IDisposable, IRelease.
Read more >How do I work with per-request lifetime scope?
As you analyze the registrations in the problem dependency chain, look at the lifetime scopes for which they're registered. If you have a...
Read more >C# – Castle.Windsor lifestyle depending on context
I have a web application where many components are registered using .LifestylePerWebRequest() , now I've decided to implement Quartz.NET, a .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, it was a bit long time ago lastly I worked with web request lifestyle. I normally don’t use it. I’ll try it again and inform you.
Ok, I will try…