温莎城堡的生活方式问题 [英] Castle windsor lifestyle issue
问题描述
我正在实现hangFire,这是我项目中的作业调度库。
I am implementing hangFire which is a job scheduling library in my project.
我正面临与本链接
但是在替换<$ c $之后c> LifestylePerWebRequest()与 HybridPerWebRequestTransient()
我仍然收到相同的错误消息:
However after replacing LifestylePerWebRequest()
with HybridPerWebRequestTransient()
I am still getting the same error message:
HttpContext.Current为空。 PerWebRequestLifestyle只能在ASP.Net中使用
HttpContext.Current is null. PerWebRequestLifestyle can only be used in ASP.Net
以下是我的依赖项安装程序的几行内容:
Here's a couple of the lines of my dependency installer:
container.Register(Component.For<IApiHra>()
.ImplementedBy(typeof(ApiHra))
.LifeStyle.HybridPerWebRequestTransient()
.IsFallback());
container.Register(Component.For<IApiHraComment>()
.ImplementedBy(typeof(ApiHraComment))
.LifestylePerWebRequest()
.IsFallback());
这是温莎控制器工厂中的控制器安装程序
This is controller installer in windsor controller factory
public class ControllersInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromThisAssembly()
.BasedOn<IController>()
.LifestyleTransient());
}
}
请让我知道是否需要其他信息。
Please let me know if any other information is required.
推荐答案
请参见Krzysztof Kozmic的回答此处。您的 IApiHra
组件可能具有 PerWebRequestLifestyle
依赖项。
See Krzysztof Kozmic's answer here. Your IApiHra
component likely has a PerWebRequestLifestyle
dependency.
这篇关于温莎城堡的生活方式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!