Disable static content caching in IIS 7

iis-7

I'm a developer having what should be a relatively simple problem in IIS 7 on Windows Server 2008 R2. The problem is that IIS 7 is overzealously caching all static content on the server. It's caching all .html and .js content and not noticing when the content changes on disk unless I iisreset.

I've tried the following:

  1. Deleting the local cache in my browser (I'm 99% positive this is a server caching issue)
  2. In IIS Admin in OutputCaching adding an .html extension and unchecking "User mode caching" and unchecking "Kernel-mode caching"
  3. In IIS Admin in OutputCaching adding an .html extension and checking "User mode caching" and selecting the radio for "Prevent all caching"
  4. In IIS Admin editing Output Cache Feature settings and unchecking "Enable cache" and "Enable kernel cache under OutputCaching.
  5. Running "C:\Windows\System32\inetsrv\config\appcmd set config "SharePoint – 80" -section:
    system.webServer/caching -enabled:false"
  6. Looking through applicationHost.config and disabling anything related to caching I could find.

Nothing seems to work. I'm getting very frustrated. Can anyone please help?

Best Answer

I would really like to see system.webServer/caching section from your applicationhost.config and web.config. Please paste them if you can. By running the above appcmd command, you have just disabled User mode caching you still have Kernel caching enabled. Also, if you really want to disable caching at the Web site or server level, just change the following:

<system.webServer>
    <caching enabled="false" enableKernelCache="false" />
</system.webServer>

You can also use Fiddler tools to verify if the content is really cached i.e. if it's returning you 304.