我目前在我的网站上缓存所有可能的内容(图像、JS、CSS)。我每次只需要重新加载一个 JS 文件。如何使用 web.config 只从缓存中省略一个文件,同时保留所有其他文件缓存?
请注意,我在这里尝试了另一个链接,它似乎并没有停止缓存我的文件: How do I disable caching of an individual file in IIS 7 using weserver config settings
最佳答案
怎么样:
<configuration>
<location path="path/to/the/file.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
</configuration>
(注意路径是相对于web.config文件的)
关于c# - 使用 Web.config 禁用单个 JS 文件的缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5235309/