OWIN-compatible implementation for "PerWebRequest" lifestyle
See original GitHub issueThe PerWebRequest HttpModule has served everyone well for applications hosted in IIS, to enable “Per webrequest” lifestyle.
However, in recent years, OWIN has become more popular and with it, the ability to self-host websites. Windsor’s PerWebRequestLifeStyle is incompatible with OWIN’s self-hosting mechanism, as HTTP modules only work in the IIS pipeline.
Some OWIN-compatible implementations of this lifestyle have been hacked together, see StackOverflow and GitHub.
However I think it would be best if such implementation was cleaned up, put under test, and integrated with the main project here. It would be a nice bonus if the same configuration syntax could be used as well (i.e. calling LifestylePerWebRequest()
). Maybe there could be some magic to make it work under all hosting scenarios.
Issue Analytics
- State:
- Created 6 years ago
- Comments:73 (14 by maintainers)
Top GitHub Comments
@mario-d-s - I was thinking we start a series of PR’s to start moving the DesktopCLR PerWebRequestLifestyleModuleRegistration stuff out of Windsor and into facilities(or something else). It is still there and supports the FEATURE_SYSTEM_WEB . The reason I say this is there has been a significant effort to migrate this windsor to dotnet core and it presents different challenges for Windsor’s public API when it comes to lifestyle management. My vote is that we talk about how we would abstract this out whilst implementing an OWIN compatible version at the same time? What do you think?
@mario-d-s: I remember reading about this many moons ago, cannot for the life of me remember why though 😃
@jonorossi: I did come across the use of AsyncLocal here. I must have missed that bit in the netcore branch when my internet was borked.
Checking out some middleware implementations would be as simple as creating an extension that goes something like this?
You could then wrap it in a tidy extension method.