Adding GET HEAD and POST Verbs in IIS Powershell

Question:

I am trying to add three HTTP request filters to my applicationhost.config file using the below:

However, each subsequent line overrides the previous one and I can only add one line it seems. I want to add all three like this:

All I end up with is the first GET being written then HEAD overriding the GET and then POST overriding the GET…I just want all three listed.

Any ideas?

Answer:

When you use the Set-WebConfigurationProperty cmdlet, you effectively override the current value of the config section element in question.

If you want to append values to multi-valued properties, you should use Add-WebConfigurationProperty instead:


If you want to make sure that only these three verbs exist in the collection, use Clear-WebConfiguration before you add them:

Source:

Adding GET HEAD and POST Verbs in IIS Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply