简体   繁体   English

IIS缓存和Web服务

[英]IIS caching and web services

I am hosting my wcf services with http binding under IIS. 我通过IIS下的http绑定托管wcf服务。

Lately I noticed that there is going on some caching of some sort. 最近,我注意到正在进行某种形式的缓存。

I need to refresh my web service till I am getting the real data, and not that been few minutes ago. 我需要刷新Web服务,直到获得真实数据为止,而不是几分钟前。

Is there a way to disable this sort of caching ? 有没有办法禁用这种缓存? and how to do so ... 以及如何做...

You could add an [AspNetCacheProfile("NoCacheProfile")] attribute to the service method(s) that is defined like this in the web.config for the application (child of the <system.web> element) : 您可以将[AspNetCacheProfile("NoCacheProfile")]属性添加到服务方法中,该属性在web.config中为应用程序定义的服务方法( <system.web>元素的子元素):

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

This is a .NET Framework 4 feature . 这是.NET Framework 4 功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM