Could anyone please explain why when creating a WCF webservice in which you want to use HttpContext.Current.Items
you need to add some code in 2 places?
One in the webservice itself ([AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
) and one in the web.config file (<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
)?
A colleague of mine just had all his webservice calls failing. He had the web.config setup missing and asked me why. I tried to explain, but I'm not sure if I was able to :)
I think it has to do with the separation of the webservice code and the place where the webservice gets hosted. The webservice itself says that it needs that compatibility mode. It is then also needed to setup the hosting environment to say that it should run in that compatibility mode. Isn't this basically the point? He still had a question: "but, if the service uses that attribute, should it not be automaticly ?"