尝试使用 Powershell 编写脚本从 IIS 网站删除特定的自定义错误。
我已经做到了这一点:
Remove-WebConfigurationProperty -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com
Run Code Online (Sandbox Code Playgroud)
但运行失败并出现警告:
Remove-WebConfigurationProperty : Cannot bind argument to parameter 'Name' because it is an empty string.
Run Code Online (Sandbox Code Playgroud)
我不知道Name在这里为参数指定什么 - 并且Remove-WebConfigurationProperty 的记录严重不足......有什么想法吗?
啊……破解了。它不是Remove-WebConfigurationProperty,而是在此上下文中使用的Clear-WebConfiguration:
Clear-WebConfiguration -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1675 次 |
| 最近记录: |