Skip to content

Instantly share code, notes, and snippets.

@NearlyUnique
Created July 15, 2016 14:14
Show Gist options
  • Save NearlyUnique/e1e466d5c9e2fb9320783387abffeed5 to your computer and use it in GitHub Desktop.
Save NearlyUnique/e1e466d5c9e2fb9320783387abffeed5 to your computer and use it in GitHub Desktop.
Adds the PUT and DELETE verbs to iis express (or vsual studio version)
param (
[switch]$vs
)
$path = "$env:UserProfile\Documents\IISExpress\config\applicationhost.config"
if ($vs) {
if (!(test-path .vs)) {
"Not in solution directory! no '.vs' directory"
exit(1)
}
$path = "$pwd\.vs\config\applicationhost.config"
}
"Loading $path"
[xml]$config = Get-Content $path
$ext = ($config.configuration.location."system.webserver".handlers.add | ? {$_.name -eq "ExtensionlessUrl-Integrated-4.0"})
"Found '$($ext.verb)'"
$verbs = $ext.verb.split(',')
if (-not $verbs.contains("PUT")) {
"Adding PUT"
$verbs += "PUT"
}
if (-not $verbs.contains("DELETE")) {
"Adding DELETE"
$verbs += "DELETE"
}
$ext.verb = ($verbs -join ',')
$config.save($path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment