2

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'.

6
  • Try using Add-WebConfigurationProperty
    – ArcSet
    Commented Aug 15, 2017 at 17:06
  • Thank you ArcSet that I didn't get the error message but it did not add the rule for ouput caching.
    – NIK_77
    Commented Aug 15, 2017 at 17:14
  • Press the up mark on my comment please
    – ArcSet
    Commented Aug 15, 2017 at 17:17
  • I tried logging in and out but I am unable to see the up arrow on your comments.
    – NIK_77
    Commented Aug 15, 2017 at 17:26
  • Thank you Ill just Put a replay and you can mark accepted
    – ArcSet
    Commented Aug 15, 2017 at 17:54

1 Answer 1

0

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

5
  • Thanks ArcSet but the system will not yet allow me to upvote for being a new member. I tried using the Add-WebConfigurationProperty but this does not seem to do anything. I used the same code as I had above just changed set to add.
    – NIK_77
    Commented Aug 15, 2017 at 18:11
  • Just an update, I created a value using the IIS GUI and then tried changing with Set-WebConfigurationProperty and it did work so I'm not sure what is not letting me add a property.
    – NIK_77
    Commented Aug 15, 2017 at 18:17
  • Has anyone else had any problems trying to use Add-WebconfigurationProperty?
    – NIK_77
    Commented Aug 17, 2017 at 12:35
  • No error but when I check the output caching in IIS there is nothing added there.
    – NIK_77
    Commented Aug 17, 2017 at 18:04
  • Really stuck on this one I can fully change the value using Set-weconfigurationProperty, but when you add-configurationproperty the command goes through and nothing is added. Has anyone else had a issue like this?
    – NIK_77
    Commented Aug 18, 2017 at 17:28

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.