views:

8

answers:

1

I have an existing Structuremap ApplicationRegistry that relies on HttpContext.Current.Server and also HttpContext.Current.Items (via HttpContextScoped). I'd like to use this in my WCF ServiceHostFactory, but HttpContext.Current remains belligerently null.

I am using basicHttpBinding and for the scope of the project I'm working on I'm happy to continue to rely on that being used. My understanding is that if you use basicHttpBinding you should be able to use HttpContext.Current. Since this is always null I've obviously missed something.

What might that be?

A: 

The solution was to add this attribute to my service class:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
ilivewithian