2016-11-30 74 views

回答

0

对于那些仍在寻找解决方案的人来说,回答这个问题还为时过早。

我在Powershell中使用了“appcmd.exe”。 下面是我在PowerShell如何使用:

# path to appcmd.exe 
$appCmd = "C:\windows\system32\inetsrv\appcmd.exe" 

# Path to the folder where we want to set the cache max-age 
# in this case its a "scripts" folder in "Default Web Site" site 
$env:folderPathScripts = "Default Web Site/scripts" 

# sets the max age to 2 days 
& $appCmd --% set config "%folderPathScripts%" -section:staticContent -clientCache.cacheControlMode:UseMaxAge -clientCache.cacheControlMaxAge:2.00:00:00 

#To disable the cache 
& $appCmd --% set config "%folderPathScripts%" -section:staticContent -clientCache.cacheControlMode:DisableCache 

我提到以下链接:

https://forums.iis.net/t/1174801.aspx?How+to+Remove+and+Add+custom+headers+convert+from+appcmd

https://technet.microsoft.com/en-us/library/jj635852(v=ws.11).aspx

https://technet.microsoft.com/en-us/library/cc770661(v=ws.10).aspx

相关问题