Castle Windsor lifestyle in dotnet core web application

What lifestyle should be used to replace PerWebRequest when using the Castle Windsor MS Adapter?


Before dotnet core I would use the PerWebRequest lifestyle for almost all of the components in the container. Now that we are disconnected from IIS modules and http context, I want to ensure my components are being created and disposed when the web requests starts and ends.


container.Register(Component.For<MyEntityFrameworkContext>) .ImplementedBy<MyEntityFrameworkContext>() .LifestyleTransient());


ASP.NET Core has it's own 'scoped' lifecycle, which is 'per request'. See it's documentation: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection

Usage example:

services.AddScoped<ICharacterRepository, CharacterRepository>();

You should do it inside ConfigureServices method in Startup class.


  • Start a program in active user session with PowerShell remoting
  • How do I check if a SSLSocket connection is sane on Java?
  • Save disconnected object in entity framework 4
  • Wait for angular to finish updating the DOM
  • Get the computer user name in a web application
  • Generating random numbers directly inside a .htaccess file
  • Redirect to trailng slash (htaccess)
  • Add Windows Feature from C#
  • what is the purpose of “export as namespace foo”?
  • File extension of zlib zipped html page?
  • Why are YouTube videos using 'youtube.com/v' not loading
  • C#: Import/Export Settings into/from a File
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • ASP.NET MVC 2 Preview 2 - display directory list rather than home/index
  • How can I display the parent menu item's description using Wordpress walkers?
  • How do I include a SWC in an AS2 Flash project?
  • Angular2 component view does not update on value change via method
  • CakePHP ACL tutorial initDB function warnings
  • Zurb Foundation _global.scss meta styles for js?
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Change Inet root folder for iis 7
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Python CGI os.system causing malformed header
  • Change JButton Shape while respecting Look And Feel
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Updating server-side rendering client-side
  • How to make Safari send if-modified-since header?
  • Web-crawler for facebook in python
  • Jquery - Jquery Wysiwyg return html as a string
  • Confusion with PayPal's monthly billing cycle
  • Is there a mandatory requirement to switch app.yaml?
  • bootstrap to use multiple ng-app
  • SetUp method failed while running tests from teamcity
  • How to get icons for entities from eclipse?
  • Understanding cpu registers
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • UserPrincipal.Current returns apppool on IIS