powershell - 使用 powershell 更新 iis 中的缓存值
问题描述
我正在尝试使用下面的 powershell 脚本更新 IIS 中的缓存值,但无法帮助获得准确的输出。有人可以帮我纠正这个问题。
Import-Module WebAdministration
Set-WebConfigurationProperty -filter "/system.webServer/staticContent/clientCache" -name cacheControlMode -value "UseExpires"
Set-WebConfigurationProperty -filter "/system.webServer/staticContent/clientCache" -name cacheControlMaxAge -value "02:00:00"
Set-WebConfigurationProperty -filter "/system.webServer/staticContent/clientCache" -name httpExpires -value "Tue, 20 Feb 2020 00:00:00 GMT"
解决方案
尝试使用 PowerShell 对象表示法链接。您可能需要关闭并打开 IIS 管理器才能看到更改。以下是它为我工作的方式
Set-WebConfiguration `
-PSPath IIS:\Sites\Default\<your web application> `
-filter '/system.webServer/staticContent/clientCache' -Value (@{cacheControlCustom=""})
推荐阅读
- python - 松弛机器人 | 获取日期选择器值
- laravel - Laravel - Collection::delete 方法不存在
- powershell - 输出以从列表中选择 PS Gui 中的用户
- c# - 矢量化没有提供预期的加速
- angular - Angular 4+ 单元测试错误。由于语法错误,我无法进行单元测试
- python - Beautifulsoup 只抢了桌子的第一项
- css - 在 3 行网格内创建粘性页脚
- java - Graphics.fillRect 行为不一致 - 在某些机器上使用负高度和宽度进行绘制,但在其他机器上没有
- flutter - 调试横幅隐藏的一半!为什么?
- html - 从 Python 中的链接下载电子表格