Castle Windsor: PerThread vs PerWebRequest in ASP.NET

ぃ、小莉子 提交于 2019-12-06 02:34:57

问题


A lot of people seem to use the PerWebRequest lifestyle in web apps for managing certain contexts. I have two concerns:

  1. PerWebRequest has a dependency on an http module (right?).

2. PerWebRequest has a dependency on HttpContext. I have some ASP.NET code that fires off in a separate thread (and loses HttpContext).

It seems that ASP.NET / IIS starts a new thread for each web request. Is there any reason not to just use the PerThread lifestyle and not have to worry about these dependencies? Or is there some advantage to PerWebRequest?

来源:https://stackoverflow.com/questions/6845898/castle-windsor-perthread-vs-perwebrequest-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!