Wcf ServiceHostFactory使用依赖于HttpContext的Structuremap

Wcf ServiceHostFactory使用依赖于HttpContext的Structuremap,wcf,structuremap,Wcf,Structuremap,我有一个现有的Structuremap ApplicationRegistry,它依赖于HttpContext.Current.Server,还通过HttpContextScope依赖于HttpContext.Current.Items。我想在我的WCF ServiceHostFactory中使用它,但是HttpContext.Current仍然是空的 我正在使用basicHttpBinding,对于我正在进行的项目范围,我很高兴继续依赖它。我的理解是,如果您使用basicHttpBinding

我有一个现有的Structuremap ApplicationRegistry,它依赖于HttpContext.Current.Server,还通过HttpContextScope依赖于HttpContext.Current.Items。我想在我的WCF ServiceHostFactory中使用它,但是HttpContext.Current仍然是空的

我正在使用basicHttpBinding,对于我正在进行的项目范围,我很高兴继续依赖它。我的理解是,如果您使用basicHttpBinding,您应该能够使用HttpContext.Current。因为这总是空的,我显然错过了一些东西


这可能是什么?

解决方案是将此属性添加到我的服务类中:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]