我正在尝试修改已安装的IIS Web应用程序,并更改身份validation方法。 Default Web Site设置为合金匿名,并禁用其他一切。 在PowerShell中使用以下行时:
Write-Host "Enabling Basic Authentication" Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/basicAuthentication -Name enabled -Value true -PSPath "IIS:\Sites\Default Web Site\$app_name"
我得到以下错误,并没有改变。
Enabling Basic Authentication Set-WebConfigurationProperty : This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by alocation tag with overrideMode="Deny" or the legacy allowOverride="false". At E:\web_iis_applications\web_application\ps_Install_web_application.ps1:61 char:1 + Set-WebConfigurationProperty -Filter /system.webServer/security/authe ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-WebConfigurationProperty], FileLoadException + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.IIs.PowerShell.Provider.SetConfigurationPropertyCommand
不过,我可以直接进入用户界面,通过右键单击并完成修改。 但是,当我必须在2台或3台服务器上执行这些安装时,这并不是很有帮助。 我知道我不应该更改Default Web Site的overridgeModeDefault设置,这就是为什么我要在默认网站下每页执行一次。
我不是这些应用程序的开发人员,所以我不确定这些选项是否可以在web.config中设置,也可以不是在每个应用程序中设置。