我在将站点部署到服务器时遇到错误。尝试加载主页或在IIS中的新站点上访问身份验证时,我收到错误:

配置错误:无法在此路径上使用此配置节。当节在父级锁定时,会发生这种情况。锁定是默认情况下(overrideModeDefault=“Deny”),或由具有overrideMode=“拒绝”或旧版的位置标记allowOverride=“false”。

更多细节可以在这里找到,在场景7中匹配我的十六进制错误代码。

上面链接站点上给出的解决方案是在applicationHost.config文件中的错误部分中设置Allow for overrideModeDefault。在我的例子中,在system.webServer中的“安全”下。但如果我查看本地计算机上的applicationHost.config(该站点已正确部署),则该部分设置为“拒绝”。

如果此解决方案是正确的,那么我的本地实例在使用相同的web.config时如何正常运行?根据我的applicationHost.config,该部分应该被锁定,但实际上没有。我宁愿不更改applicationHost.config文件,因为该服务器上还有许多其他站点在运行。还有其他解决方案吗?


当前回答

我也有同样的问题。我从web.config文件中删除了此部分。

<modules>
      <remove name="WebDAVModule" />
</modules>

其他回答

对于Windows Server 2008和IIS 7,过程类似。请参阅:http://msdn.microsoft.com/en-us/library/vstudio/bb763178(v=vs.100).aspx

在添加角色服务中,您将看到“应用程序开发功能”

检查(启用)功能。我检查了所有。

浏览到“C:\Windows\System32\inetsrv\config”(此处需要管理员权限)打开applicationHost.config

注意:在IISExpress和Visual Studio 2015中,applicationHost.config存储在$(solutionDir).vs\config\applicationHost.config中

查找错误消息页面的“配置源”部分中显示的部分。对我来说,这通常是“模块”或“处理程序”

将overrideModeDefault属性更改为Allow

所以整条线现在看起来像:

<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />

保存文件后,页面在我的浏览器中加载良好。

警告:在64位Windows上编辑applicationHost.config

Powershell启用功能的方式(Windows Server 2012+)-根据需要进行微调:

Install-WindowsFeature NET-Framework-Core
Install-WindowsFeature Web-Server -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-Features -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-45-ASPNET -IncludeAllSubFeature
Install-WindowsFeature Application-Server -IncludeAllSubFeature
Install-WindowsFeature MSMQ -IncludeAllSubFeature
Install-WindowsFeature WAS -IncludeAllSubFeature

在我的案例中,除了浏览之外,我在尝试更新IIS中的身份验证设置时也遇到了此错误。我能够通过从web.config本身删除身份验证设置来删除此错误。在某些情况下,删除有问题的配置部分可能比过多地更改服务器角色和功能更具侵入性和可取性:

删除的部分:

    <security>
        <authentication>
            <windowsAuthentication enabled="true" />
        </authentication>
    </security>

当我收到这条漂亮的消息时,我需要更改子文件夹上的SSL设置。在我的情况下,接下来的行动帮助了我。

已打开C:\Windows\System32\inetsrv\config\applicationHost.config

并将值从overrideModeDefault=“拒绝”更改为“允许”

<sectionGroup name="system.webServer">
 ...
    <sectionGroup name="security">
        <section name="access" overrideModeDefault="Allow" />
    </sectionGroup>