Caching 利用浏览器缓存:无法设置<;地点>;web.config文件中的属性
对于浏览器缓存,我只想为web.config中的一个.js文件而不是整个js文件夹设置过期时间。为此,我在的帮助下尝试使用以下配置,但不起作用:Caching 利用浏览器缓存:无法设置<;地点>;web.config文件中的属性,caching,web-config,browser-cache,Caching,Web Config,Browser Cache,对于浏览器缓存,我只想为web.config中的一个.js文件而不是整个js文件夹设置过期时间。为此,我在的帮助下尝试使用以下配置,但不起作用: <configuration> <location path="compiled.js"> <system.webServer> <staticContent> <clientCache cacheControlMode="UseMa
<configuration>
<location path="compiled.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
</system.webServer>
</location>
</configuration>
然后我尝试更改“位置”属性中的路径,如下所示,但这对我也不起作用:
<configuration>
<location path="~/js/compiled.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
</system.webServer>
</location>
</configuration>
有人能帮助我如何通过web.config为一个.js文件而不是整个文件夹设置缓存过期时间吗?对于单个文件,我们可以在web.config文件中设置缓存过期时间,如下所示:
<configuration>
<location path="js/compiled.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
</system.webServer>
</location>
</configuration>
此外,我们还可以使用不同的
部分指定不同文件/文件夹的缓存设置。如果您的答案解决了问题,请将其标记为已接受。