![](/img/trans.png)
[英]How to add a <remove /> block using Remove-WebConfigurationProperty to a web.config?
[英]What “Name” parameter must I specify to remove an IIS custom error using Remove-WebConfigurationProperty in Powershell?
尝试使用Powershell编写脚本来清除IIS网站中的特定自定义错误。
我已经做到了这一点:
Remove-WebConfigurationProperty -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com
但运行失败并显示以下警告:
Remove-WebConfigurationProperty : Cannot bind argument to parameter 'Name' because it is an empty string.
我不知道在这里为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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.