【问题标题】: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此配置部分不能在此路径中使用。当该部分锁定在父级别时会发生这种情况。默认情况下锁定是
【发布时间】:2019-07-24 09:24:59
【问题描述】:

我收到这个错误

"此配置部分不能在此路径中使用。当该部分在父级别锁定时会发生这种情况。锁定是默认情况下 (overrideModeDefault="Deny"),或者由具有 overrideMode=" 的位置标记显式设置拒绝”或旧的 allowOverride="false"。”

当我在 Windows Server 2012 的 IIS 上部署网站时。你们能告诉我如何解决这个问题吗? 在此先感谢

<configuration>
  <configSections>

    <sectionGroup name="system.web.extensions" 
      type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
            System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35">

      <sectionGroup name="scripting" type="System.Web.Configuration.
            ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, 
            Culture=neutral, PublicKeyToken=31BF3856AD364E35">

        <section name="scriptResourceHandler" type="System.Web.Configuration.
            ScriptingScriptResourceHandlerSection, System.Web.Extensions, 
            Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
            requirePermission="false" allowDefinition="MachineToApplication" />

        <sectionGroup name="webServices" type="System.Web.Configuration.
            ScriptingWebServicesSectionGroup, System.Web.Extensions, 
            Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

          <section name="jsonSerialization" type="System.Web.Configuration.
            ScriptingJsonSerializationSection, System.Web.Extensions, 
            Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
            requirePermission="false" allowDefinition="Everywhere" />

          <section name="profileService" type="System.Web.Configuration.
            ScriptingProfileServiceSection, System.Web.Extensions, 
            Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
            requirePermission="false" allowDefinition="MachineToApplication" />

          <section name="authenticationService" type="System.Web.Configuration.
            ScriptingAuthenticationServiceSection, System.Web.Extensions, 
            Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
            requirePermission="false" allowDefinition="MachineToApplication" />

          <section name="defaultDocument" overrideModeDefault="Allow" />

          <section name="roleService" type="System.Web.Configuration.
            ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, 
            Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
            requirePermission="false" allowDefinition="MachineToApplication" />

        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <startup>
    <supportedRuntime version="v4.0" />
  </startup>

  <runtime>
    <CompatSortNLSVersion enabled="4096" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>

        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <authentication mode="Windows">
    <forms loginUrl="login.aspx" protection="All" timeout="10000">
    </forms>
  </authentication>

【问题讨论】:

  • 错误页面通常还会告诉您在哪一行观察到错误。您应该编辑您的问题以明确说明。

标签: c# .net iis-7


【解决方案1】:

&lt;system.web&gt; 部分中设置&lt;authentication&gt; 元素的模式属性。 请提供完整的错误消息快照和 web.config 文件代码。而且您不能像这样<authentication mode="Windows"> <forms loginUrl="login.aspx" protection="All" timeout="10000"> </forms> </authentication> 设置Windows 身份验证。

表单认证使用代码如下:

 <configuration>

<system.web>

    <authentication mode="Windows" />

     <authorization>
         <deny users="?"/>
      </authorization>

</system.web>

对于表单认证:

    <authentication mode="Forms">
<forms loginUrl="logon.aspx" name="adAuthName" timeout="60" path="/"> </forms>
</authentication>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-09
    • 1970-01-01
    相关资源
    最近更新 更多