HTTP Error 500.19 in IIS 10 and Visual Studio 2017

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.


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>

  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>