views:

50

answers:

1

Does anybody know if WCF support kind of caching like it was with Web Services or should i implement it manually?

A: 

I believe you need to set the [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] attribute on your WCF implementation class, as in

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class MyService: IMyService
{
   public void SomeMethod()
   {
        HttpContext.Current.Cache["someKey"] = "someValue";
   }
}

See http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.aspnetcompatibilityrequirementsmode.aspx for more details.

Guido Domenici