简体   繁体   中英

IIS caching and web services

I am hosting my wcf services with http binding under IIS.

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.

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) :

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

This is a .NET Framework 4 feature .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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