简体   繁体   中英

IIS output caching setting using PowerShell

I have been trying to find a way to configure the IIS 'outputcaching' setting. I have been looking around and having really had anything that works. I am basically trying to set output caching for an extension .pdf and the setting "until changed".

I've tried this code:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web 
Site' -Filter "system.webServer/caching/profiles/add[@extension='.pdf']" -
Name "kernelCachePolicy" -Value "CacheUntilChange"

but that gave me the following error:

WARNING: Target configuration object 'system.webServer/caching/profiles/add[@extension='.pdf'] is not found at path 'MACHINE/WEBROOT/APPHOST/Default Web Site'.

Try using Add-WebConfigurationProperty

Add-WebConfigurationProperty Will add a property that isn't there.

Set-WebConfigurationProperty Changes the value of a property that already exists

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM