How do I stop IIS from caching any files, ever, under any circumstances?

我的梦境 提交于 2019-12-03 23:51:30

I suspect that you have enabled output caching, this would exhibit the behaviour that you are describing where recycling the app pool or restarting IIS clears them and allows you to see the new content.

This page gives more information, http://www.iis.net/learn/manage/managing-performance-settings/walkthrough-iis-output-caching

If you are using IIS Express then it is likely that the caching is set at the application level in your web.config, or on individual pages.

You need to set

<caching>
   <outputCache enableOutputCache="false" />
</caching>

or if its IIS 7+ (Which IIS Express will be)

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

If anyone stumbles upon this and wants a "mouse click" way of disabling cache in IIS 7 or so... here's an answer from IIS forums on https://forums.iis.net/t/959070.aspx :

Here's an update for IIS 7.5 (in Windows 7). Disabling the cache is a good thing to do during development when you're not concerned with performance and want to see changes take place immediately. It speeds up the development process. - Start IIS Manager (type IIS into search programs and files in start menu) - Navigate to desired site in the Connections tree (Default Web Site) - Open Output Caching - Edit Feature Settings - Uncheck Enable cache and Enable kernel cache

You get a setting in web.config file something like this:

<caching enabled="false" enableKernelCache="false">
            <profiles>
                <add extension=".css" policy="DontCache" kernelCachePolicy="DontCache" />
                <add extension=".script" policy="DontCache" kernelCachePolicy="DontCache" />
            </profiles>
        </caching>

So, no tag here..

Mahesh Kava

Quite possible it's the browser which is the culprit. Have you tried ctrl+ F5 ?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!