我正在对我们的企业API应用缓存。为了与支持反向代理缓存的负载均衡器兼容,我试图实现类型为“public,max-age = 600”的缓存控制。如何使用WCF中的AspNetCacheProfile实现“Cache-Control:public,max-age = 600”
但是,我只能得到WCF输出“私人,最大年龄= 600”,这是不正确的反向代理缓存。
我有以下配置文件设置为位置:服务器(因为我需要ASP应用程序级缓存),但我也尝试了所有其他位置,但没有人会给我公开。
<caching>
<outputCache enableOutputCache="true"/>
<outputCacheSettings>
<outputCacheProfiles>
<add name="CacheDefault" duration="600" varyByParam="none" location="Any" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
即时通讯使用标准WCF这个样子,没有什么花哨:
[AspNetCacheProfile("CacheDefault")]
[OperationContract]
[WebGet(UriTemplate = "/GetData/{value}")]
string GetData(string value);
我甚至开始了一个全新的WCF服务项目只是为了消除任何混杂变量,可能是在我目前的生产代码,但它仍然输出私人。
P.S.我应该清楚说明我并不是想手动覆盖WebOperationContext.current.outgoingresponse.headers。我在配置AspNetCacheProfile后迅速获胜。
任何帮助将是伟大的!
非常感谢!
Oliver
对不起,但这不适合这种情况。非常感谢,奥利弗 – 2011-12-14 13:12:56