Samurai Jack
Samurai Jack

Reputation: 3125

HTTP Error 500.19 in IIS 10 and Visual Studio 2017

I know that similar questions have been asked but their answer are not solving my problem.

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information: Module IIS Web Core Notification BeginRequest Handler Not yet determined 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 \?\C:\mySite\web.config

Requested URL http://localhost:80/mySite/login

Physical Path C:\mySite\login

Logon Method Not yet determined

Logon User Not yet determined

Config Source:

65: </staticContent>

66: <handlers>

67:

<add name="ReportViewerWebControlHandler"
    > preCondition="integratedMode" verb="*"
    > path="Reserved.ReportViewerWebControl.axd"
    > type="Microsoft.Reporting.WebForms.HttpHandler,
    > Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral,
    > PublicKeyToken=b03f5f7f11d50a3a" />

I checked in Windows features also and they look alright.

I've tried to set overrideModelDefault to Allow and to remove WebServiceHandlerFactory from applicationhost.congif but no result.

I'm using Visual Studio 2017 and IIS 10.

Any other ideas how to solve this?

Upvotes: 16

Views: 63361

Answers (10)

Maruf
Maruf

Reputation: 456

Make sure to install the appropriate Hosting Bundle after enabling IIS

In my case:

  1. Installed Hosting Bundle
  2. Enabled IIS

and got this unhappy message:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid

Reinstalling Hosting Bundle solved the problem

Upvotes: 1

vldmr-bus
vldmr-bus

Reputation: 53

I suddenly started getting this error out of blue when launching debug of ASP.NET project in IIS Express from VisualStudio. While (re)examining the file .vs\config\applicationhost.config I noticed the following suspicious line:

<virtualDirectory path="/" physicalPath="C:\Users\me\OneDrive\Documents\My Web Sites\project.Web-Site2" />

I would never consciously use OneDrive for anything related to development. But our IT is in the process of adopting OneDrive organization wide. So they probably changed some settings of my profile that caused VisualStudio to update IIS Express config with that path. And "My Web Sites" directory did not exist there. So after I updated the line as following:

<virtualDirectory path="/" physicalPath="C:\inetpub\www" />

and created the directory empty C:\inetpub\www, everything started to work again.

Hope this story may save someone few wasted troubleshooting hours.

Upvotes: 2

Ali Bayat
Ali Bayat

Reputation: 4056

  1. Press Win Key+R to Open Run Window
  2. in the Run Window, enter "OptionalFeatures.exe"
  3. in the features window, Click: "Internet Information Services"
  4. Click: "World Wide Web Services"
  5. Click: "Application Development Features"
  6. Check the features.

I'm using Windows 10

Note: "You must be signed in as an administrator to be able to turn Windows features on or off." If Windows Features is empty or blank, then double-check to make sure that the Windows Modules Installer service is enabled and set to Automatic.

Update:

Make sure .NET Core Windows Server Hosting bundle is installed

Other possible solutions:

Solution 1:

Run these two commands from an elevated command prompt

%windir%/system32/inetsrv/appcmd unlock config /section:anonymousAuthentication

%windir%/system32/inetsrv/appcmd unlock config -section:windowsAuthentication

Solution 2: Using PowerShell

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

Solution 3: Removing the <rewrite> tag in web.config

<system.webServer>
    ...
    <rewrite>
    ...
    </rewrite>
</system.webServer>

Upvotes: 37

Akhil M
Akhil M

Reputation: 1

This could be a Web.config file sharing problem. Check if the wwwroot folder is shared, and also check the folder which contains publish/build inside.

Upvotes: 0

Sha
Sha

Reputation: 2397

For me, the problem was a redirection rule in web.config.

Solved by removing the entire <rewrite>-tag in web.config:

<system.webServer>
...
...
<rewrite>
      <rules>
        <rule name="http to https" enabled="true" stopProcessing="true">
          <match url="(.*)"/>
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$"/>
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" appendQueryString="true"/>
        </rule>
      </rules>
    </rewrite>
 </system.webServer>

Upvotes: 11

Marketman
Marketman

Reputation: 11

I had used the wrong framework. I had chosen .NET 3.5 in my project properties. After changing that to .NET 4 the problem was gone. .NET 4 is the only framework that can be chosen in my IIS 10 version.

Upvotes: 0

Wagner Pereira
Wagner Pereira

Reputation: 1078

In my case (VS 2019), I just changed the port in project property / Web / Project URL

and I pressed the button "Create Virtual Directory"

before http://localhost:40430/XX

after http://localhost:1438/XX

Upvotes: 1

Oyvind Habberstad
Oyvind Habberstad

Reputation: 1052

I had a similar error message, when trying to run regular asp.net applications after installing the .NET Core Hosting Bundle -> https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2

Comparing my C:\Windows\System32\inetsrv\Config\applicationHost.config with a version from a colleague, we saw that there was missing some sectionsGroup's: enter image description here

Upvotes: 0

Golnaz Saraji
Golnaz Saraji

Reputation: 154

I faced this problem. For me putting the connection string after configSections which contained the entityframework section, solved the problem.

Upvotes: 0

Newred
Newred

Reputation: 729

It's no problem in web.config file.

After installation windows, 
IIS does not know how to support .NET Core 2.0 website (or Core 1.0 also) by default

You must to install the .NET Core Windows Server Hosting bundle on the hosting system.

Upvotes: 10

Related Questions