HTTP错误500.19 - 错误代码0x80070021

3

背景:尝试调试 WebForms 应用程序并从 AD 获取经过身份验证的 Windows 用户,

在 F5 上,我被这个惊人的页面所欢迎。

模块 WindowsAuthenticationModule

通知 AuthenticateRequest

处理程序 ExtensionlessUrl-Integrated-4.0

错误代码 0x80070021

配置错误 此配置部分无法在此路径使用。 当该部分在父级别上被锁定时,就会发生这种情况。 锁定可以是默认的(overrideModeDefault =“Deny”),也可以通过具有 overrideMode =“Deny” 或遗留 allowOverride =“false”的位置标记来显式设置。

onDebug

配置来源:

   81:         <anonymousAuthentication enabled="false"/>
   82:         <windowsAuthentication enabled="true"/>
   83:         <basicAuthentication enabled="false"

我的 Web.config(只是不同的名称)

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    <!--<section name="windowsAuthentication" overrideModeDefault="Allow" />
    <section name="anonymousAuthentication" overrideModeDefault="false" />
    <add name="WindowsAuthenticationModule" lockItem="false" />
    <add name="AnonymousAuthenticationModule" lockItem="false" />-->
  </configSections>
    <connectionStrings>
    <!--<add name="MyContext" connectionString="Data Source=idea-pc;Initial Catalog=componentnameNumber;Integrated Security=True" providerName="System.Data.SqlClient"/>-->
    <add name="DBComponent1" connectionString="Data Source=idea-pc;Initial Catalog=comp2;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="DBComponent2" connectionString="Data Source=idea-pc;Initial Catalog=comp3;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="DBComponent3" connectionString="Data Source=idea-pc;Initial Catalog=comp4;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="DBComponent4" connectionString="Data Source=idea-pc;Initial Catalog=comp5;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-MyProj-20160209113257.mdf;Initial Catalog=aspnet-MyProjectEvents-20160209113257;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
        <authentication mode="Windows"/>
        <identity impersonate="false"/>
        <authorization>
           <allow users="*"/>
        </authorization>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5"/>
        <customErrors mode="Off"/>
    <!--</system.web>-->
    <pages>
      <namespaces>
        <add namespace="System.Web.Optimization"/>
        <add namespace="Microsoft.AspNet.Identity"/>
      </namespaces>
      <controls>
        <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
      </controls>
    </pages>
    <membership>
      <providers>
        <!--
        ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
        <clear/>
      </providers>
    </membership>
    <profile>
      <providers>
        <!--
        ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
        <clear/>
      </providers>
    </profile>
    <roleManager>
      <!--
          ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
        -->
      <providers>
        <clear/>
      </providers>
    </roleManager>
    <!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
    <sessionState mode="InProc" cookieless="false" timeout="30" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
      </providers>
    </sessionState>
  </system.web>
  <system.webServer>
    <security>
      <authentication>
        <anonymousAuthentication enabled="false"/>
        <windowsAuthentication enabled="true"/>
        <basicAuthentication enabled="false"
                             realm=""
                             defaultLogonDomain="TestDomain"/>
      </authentication>
    </security>



    <modules>
      <!--<remove name="FormsAuthentication"/>-->
    </modules>
  </system.webServer>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"/>
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>

我四处查看并检查了我的设置,发现在我的IIS->万维网服务->安全性下没有Windows身份验证。

enter image description here

即使禁用匿名身份验证,我这里也没有它。

enter image description here

我需要检查或者做什么才能解决问题?由于我还是一个新手,我不知道该怎么做

编辑:

enter image description here


https://dev59.com/L2Ij5IYBdhLWcg3wpWhx - January Mmako
@JanuaryMmako,我想我已经尝试了那篇帖子中的大部分方法。我已经为此问题奋斗了6-7个小时,试图弄清楚它是如何工作的。在应用程序开发方面,我已经按照那篇帖子上发布的内容进行了操作。我将更新问题并提供更多信息以澄清。 - Froxer
2个回答

4
我曾经尝试编辑applicationhost.config文件,并在Authentication节点下将以下元素的DENY更改为ALLOW,这对我很有用:
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<section name="windowsAuthentication" overrideModeDefault="Allow" />

希望这有所帮助!

很不幸,没有人点赞或评论,但这是对于这个问题最有用的答案,它帮助了我很多次,而且不止一次,非常感谢你,兄弟。 - Abdul

1
你使用的Windows版本是低端版本,甚至不支持Windows身份验证。
你需要升级到高端版本,例如专业版。

1
猜测我在编码而没有构建。 - Froxer

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接