WCF caching like it was with WebServices
Does anybody know if WCF support kind of caching like it 开发者_JS百科was with Web Services or should i implement it manually?
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.
精彩评论