2012-06-08 231 views
1

我在IIS下使用http绑定托管我的wcf服务。IIS缓存和Web服务

最近我注意到有某种缓存存在。

我需要刷新我的web服务,直到我得到真实的数据,而不是几分钟前。

有没有办法禁用这种缓存?如何做到这一点?

回答

1

你可以一个[AspNetCacheProfile("NoCacheProfile")]属性添加到这样定义在web.config中的应用程序(<system.web>元素的子级)的服务方法(S):

<caching> 
    <outputCacheSettings> 
    <outputCacheProfiles> 
     <add name="NoCacheProfile" noStore="true" duration="0" varyByParam="none" enabled="true"/> 
    </outputCacheProfiles> 
    </outputCacheSettings> 
</caching> 

这是一个.NET Framework 4 feature