【问题标题】:IIS configuration to modify 'maximum content length' using power shell使用 powershell 修改“最大内容长度”的 IIS 配置
【发布时间】:2020-07-29 13:49:09
【问题描述】:

我正在尝试将“最大内容长度”的值配置为“30000000”(大约 28.6 MB)。我的脚本如下-

 cd C:\Windows\System32\inetsrv
 ./appcmd set config /section:requestfiltering /requestlimits.maxallowedcontentlength:30000000

 If ((Get-WindowsFeature Web-Filtering).Installed -EQ $true) {
   Get-Website | Foreach-Object {
       $site = $_
      [PSCustomObject]@{
      "Site" = $site.Name
      "maxAllowedContentLength" = (((Get-WebConfiguration -Filter 'system.webServer/security/requestFiltering' -PSPath "IIS:\sites\$($site.Name)").requestLimits).Attributes | Where-Object Name -EQ 'maxAllowedContentLength').Value
      }
     }
    }

脚本成功执行,但是当我使用“Internet 服务管理器”检查时,没有任何变化反映在那里。我想知道脚本中是否有任何错误?因为它不会返回任何错误来进行故障排除。

【问题讨论】:

  • 你可以在专门的论坛IIS Forum问这个问题。
  • 如果在个别站点上也设置了服务器级配置,将无济于事:./appcmd set config /section:... -> ./appcmd set config "siteName" /section:...
  • 您能分享一下您的确切退休时间吗?你想设置在服务器级别还是站点级别?我试过你的脚本,它在我身边运行良好。 image
  • 我需要在站点级别应用更改,但脚本在服务器级别应用更改。

标签: windows powershell iis automation registry


【解决方案1】:

这帮助我找到了解决方案: ./appcmd set config "WebsiteName"/section:requestfiltering /requestlimits.maxallowedcontentlength:30000000 /commit:site

【讨论】:

  • 如果您的问题得到解决,那么我请求您将有用的建议标记为答案。这将帮助面临同样问题的其他人。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-06
  • 1970-01-01
相关资源
最近更新 更多