VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021 [Answered]RSS

6 replies

Last post Sep 11, 2020 01:14 AM by Remmy

  • VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 09, 2020 05:37 PM|Remmy|LINK

    I am using VS 2019 Version 16.7.2 and IIS 10. I am getting the following error when trying to compile a APS.NET VB web application. I have tried several fixes that I found on the internet but nothing is working. I have edited the applicationHost.config file but there seems to be several copies in various places on the c: drive. Which one is used by IIS?

    ------------------------------------------------------------------------------------------

    <div class="content-container">

    HTTP Error 500.19 - Internal Server Error

    The requested page cannot be accessed because the related configuration data for the page is invalid.

    </div> <div class="content-container">

    Detailed Error Information:

    <div id="details-left">
    Module    AnonymousAuthenticationModule
    Notification    AuthenticateRequest
    Handler    PageHandlerFactory-Integrated-4.0
    Error Code    0x80070021
    Config Error    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 a location tag with overrideMode="Deny" or the legacy allowOverride="false".
    Config File    \\?\D:\SVN\AM01\web.config
    </div> <div id="details-right">
    Requested URL    http://localhost:59024/Default.aspx
    Physical Path    D:\SVN\AM01\Default.aspx
    Logon Method    Not yet determined
    Logon User    Not yet determined
    <div class="clear"></div> </div>
    </div> <div class="config_source content-container">

    Config Source:

      217:             <authentication>
      218:                 <anonymousAuthentication enabled="false" />
      219:             </authentication>
    </div>
  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 09, 2020 05:49 PM|lextm|LINK

    Remmy

    I am using VS 2019 Version 16.7.2 and IIS 10.

    Probably you need to learn first what you actually use, IIS or IIS Express.

    If IIS Express is used, then it is rather easy to know which config file is being used, https://docs.jexusmanager.com/getting-started/features.html

    Lex Li
    Affordable IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 09, 2020 09:01 PM|Remmy|LINK

    IIS Express 10 is the only IIS that is installed on my machine. It comes with VS 2019. But There are applicationHost.config files located in the visual studio project folder for the web application under .vs\config, and then there is one under Windows\System32\inetsrv\config, and one under Windows\System32\inetsrv\config. Keep in mind that this is a new laptop with a fresh install of VS 2019. You would think that the one in the project folder would be the one, but I am not sure what needs to be changed. When I try to compile the web application is when the error occurs.

  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 09, 2020 11:34 PM|lextm|LINK

    Remmy

    applicationHost.config files located in the visual studio project folder for the web application under .vs\config

    That's the one you should modify for IIS Express.

    Remmy

    there is one under Windows\System32\inetsrv\config

    That means you also installed full IIS, so not merely IIS Express is on this machine.

    Lex Li
    Affordable IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 10, 2020 07:37 AM|Jalpa Panchal|LINK

     open .vs\config\applicationhost.config:

    Look for the following lines:

    <section name="windowsAuthentication" overrideModeDefault="Deny" />
    <section name="anonymousAuthentication" overrideModeDefault="Deny" />
    <add name="WindowsAuthenticationModule" lockItem="true" />
    <add name="AnonymousAuthenticationModule" lockItem="true" />

    Change those lines to:

    <section name="windowsAuthentication" overrideModeDefault="Allow" />
    <section name="anonymousAuthentication" overrideModeDefault="Allow" />
    <add name="WindowsAuthenticationModule" lockItem="false" />
    <add name="AnonymousAuthenticationModule" lockItem="false" />

    Save the file and refresh your asp.net web page. 

    if you are using iis:

    1)Open IIS Manager

    2)Select the server in the Connections pane

    3)Open Configuration Editor in the main pane

    4)In the Sections drop-down, select the section to unlock, e.g.system.webServer/security/authentication/anonymousAuthentication

    5)Click Unlock Attribute in the right pane

    6)Restart IIS (optional) - Select the server in the Connections pane, click Restart in the Actions pane

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 11, 2020 01:13 AM|Remmy|LINK

    Great! Thank You.

  • Re: VS 2019 APS.NET VB IIS 10 - Error Code 0x80070021

    Sep 11, 2020 01:14 AM|Remmy|LINK

    Thanks for all your help Lextm.