在任何情况下,如何停止IIS缓存任何文件? [英] How do I stop IIS from caching any files, ever, under any circumstances?

查看:195
本文介绍了在任何情况下,如何停止IIS缓存任何文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事一些Web开发工作,而对IIS来说,对我的生产力影响最大的是。它缓存即使更改后也不会更新的文件,除非重新启动IIS。具体来说,我指的是html,js和css文件。这个问题迫使我不断停止和启动我的Web应用程序。由于我具有Windows 7,因此我相信自己拥有ISS 7.5。我正在使用IIS Express。这实在令人沮丧,以至于我希望IIS永远不要缓存任何内容。对于停止所有形式的缓存或仅针对我正在从事的项目的解决方案,我都很好。

I do some web development for work and the biggest hit to my productivity comes from IIS. It caches files that will not update even when they are changed, unless I restart IIS. Specifically, I am referring to html, js, and css files. This problem forces me to stop and start my web application constantly. Since I have Windows 7 I believe I have ISS 7.5. I am using IIS Express. This is so frustrating that I'd prefer IIS to never cache anything, ever. I am fine with a solution that stops all forms of caching or just for the project I am working on.

IIS管理器对我不可用。它不在管理工具-> IIS管理器中。 .aspx rel = noreferrer> https://technet.microsoft.com/zh-cn/library/cc770472%28v=ws.10%29.aspx 。另外,在开始搜索框中搜索inetmgr也没有结果。因此,我正在寻找对IIS applicationhost.config文件的修复。

IIS Manager is not available to me. It is not located in System and Security -> Administrative Tools -> IIS Manager like is suggested by https://technet.microsoft.com/en-us/library/cc770472%28v=ws.10%29.aspx. Also, searching for inetmgr in the Start Search box gets me no results. Because of this, I am looking for a fix to the IIS applicationhost.config file.

我试图在我的applicationhost.config文件中放置以下内容,但该方法无效:

I have tried putting the following in my applicationhost.config which doesn't work:

<location path="ProjectName">
    <system.webServer>
        <staticContent>
           <clientCache cacheControlCustom="public" cacheControlMode="DisableCache" />
        </staticContent>
       <caching enabled="false" enableKernelCache="false"></caching>
    </system.webServer>
</location>

StackOverflow中与我的问题最接近的问题是从未替换的IIS缓存文件。但是,Fiddler向我展示了即使更改了旧文件也将它们发送到浏览器。

The closest question on StackOverflow to my problem was IIS cached files never replaced. However, Fiddler shows me that the old files are being sent to the browser even after they have been changed.

IIS如何在不重新启动浏览器的情况下向我的浏览器发送更新的文件?

How can IIS to send my browser the updated files without having to restart it?

推荐答案

我怀疑您已启用输出缓存,这将表现出您所描述的行为,即在回收应用程序池或重新启动IIS会清除它们并允许您查看新内容的位置。

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.

此页面提供了更多信息, http: //www.iis.net/learn/manage/managing-performance-settings/walkthrough-iis-output-caching

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

如果您使用的是IIS Express那么很可能是在您的web.config或单个页面中的应用程序级别设置了缓存。

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.

您需要设置

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

或它的IIS 7+(将是哪个IIS Express)

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

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

这篇关于在任何情况下,如何停止IIS缓存任何文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆