Skip to content

Instantly share code, notes, and snippets.

@georgepaoli
Created April 24, 2020 00:56
Show Gist options
  • Save georgepaoli/7d3a0c967c9810d7a95b0b9cffd9f4f4 to your computer and use it in GitHub Desktop.
Save georgepaoli/7d3a0c967c9810d7a95b0b9cffd9f4f4 to your computer and use it in GitHub Desktop.
Comando uteis no Powershell
# clear IIS requestLimits
Get-IISConfigSection "system.webServer/security/requestFiltering" -CommitPath "Default Web Site" | Get-IISConfigElement -ChildElementName 'requestLimits' | Remove-IISConfigElement -Confirm:$false
# change IIS requestLimits
$requestFiltering = Get-IISConfigSection -CommitPath 'Default Web Site' -SectionPath 'system.webServer/security/requestFiltering'
$requestLimits = Get-IISConfigElement -ConfigElement $requestFiltering -ChildElementName 'requestLimits'
Set-IISConfigAttributeValue -ConfigElement $requestLimits -AttributeName "maxAllowedContentLength" -AttributeValue 209715200
# change IIS requestLimits by xml
$file = 'C:\inetpub\wwwroot\web.config'
$xml = [xml](Get-Content $file)
$xml.SelectNodes("/configuration/system.webServer/security/requestFiltering/requestLimits") | foreach{$_.maxAllowedContentLength = "209715200"}
$xml.Save($file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment