title: Error 500.19 with 0x8007000d when running ASP.NET Core app in IIS despite AspNetCoreModule being installed
body: <p>I have an ASP.NET Core app that runs great in IIS Express.  Similarly, if I launch the app from the command line via <code>dotnet run</code>, everything works smoothly:</p>
  
  <pre><code>C:\Code\Sandbox\IisTestApp\IisTestApp&gt;dotnet run
  Using launch settings from C:\Code\Sandbox\IisTestApp\IisTestApp\Properties\launchSettings.json...
  Hosting environment: Production
  Content root path: C:\Code\Sandbox\IisTestApp\IisTestApp
  Now listening on: http://localhost:5000
  Now listening on: https://localhost:5001
  Application started. Press Ctrl+C to shut down.
  </code></pre>
  
  <p>If I try to target local IIS, I get the following error:</p>
  
  <blockquote>
    <p>Unable to start process C:\Program Files\dotnet\dotnet.exe. The web server request failed with status code 500, Internal Server Error. The full response has been written to C:\Users{my user name}\AppData\Local\Temp\HttpFailure_08-05-50.html.</p>
  </blockquote>
  
  <p>The HTML file contains this information:</p>
  
  <p><a href="https://i.stack.imgur.com/mrhLL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mrhLL.png" alt="Screenshot of 500.19 error"></a></p>
  
  <blockquote>
    <h1>HTTP Error 500.19 - Internal Server Error</h1>
    
    <p><strong>The requested page cannot be accessed because the related configuration data for the page is invalid.</strong></p>
    
    <p><strong>Detailed Error Information:</strong></p>
    
    <p><strong>Module</strong>       IIS Web Core<br>
    <strong>Notification</strong>     BeginRequest<br>
    <strong>Handler</strong>      Not yet determined<br>
    <strong>Error Code</strong>       0x8007000d<br>
    <strong>Config Error</strong><br>
    <strong>Config File</strong>      \?\C:\Code\Sandbox\IisTestApp\IisTestApp\web.config<br>
    <strong>Requested URL</strong>    <a href="http://localhost:80/IisTestApp" rel="noreferrer">http://localhost:80/IisTestApp</a><br>
    <strong>Physical Path</strong>    C:\Code\Sandbox\IisTestApp\IisTestApp<br>
    <strong>Logon Method</strong>     Not yet determined<br>
    <strong>Logon User</strong>       Not yet determined</p>
  </blockquote>
  
  <p><em>Note: in case it's not obvious from that message, this is a minimal repro of my problem, not the actual app</em></p>
  
  <p>Most of what I see online says that the error code <code>0x8007000d</code> indicates that I don't have the .NET Core Windows Server Hosting component (<code>AspNetCoreModule</code>), but I definitely have installed that:</p>
  
  <p><a href="https://i.stack.imgur.com/6LJyh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6LJyh.png" alt="screenshot of add remove programs with hosting component installed"></a></p>
  
  <p>I can also see it in the main "Modules" page of IIS, and verified that the file it points to actually exists:</p>
  
  <p><a href="https://i.stack.imgur.com/JCX8A.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JCX8A.png" alt="Screenshot of modules list in IIS"></a></p>
  
  <p>Strangely, if I try to go to the Modules page for this specific site, I get the same error message as the web page:</p>
  
  <blockquote>
    <p>There was an error while performing this operation.</p>
    
    <p>Details: </p>
    
    <p>Filename: \?\C:\Code\Sandbox\IisTestApp\IisTestApp\web.config<br>
    Error: </p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/hGOha.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hGOha.png" alt="Screenshot of site modules error"></a></p>
  
  <p>This hosting module version (2.1.8) matches generally what I have installed:</p>
  
  <pre><code>C:\Users\{my user name}&gt;dotnet --list-sdks
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  
  C:\Users\{my user name}&gt;dotnet --list-runtimes
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  </code></pre>
  
  <p>And what my test app is targeting:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.App" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>
  
  <p>Despite all that, I think the problem really is related to IIS and that hosting component!  Here is the (very default) web.config that is generated with the project template:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;location path="." inheritInChildApplications="false"&gt;
      &lt;system.webServer&gt;
        &lt;handlers&gt;
          &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /&gt;
        &lt;/handlers&gt;
        &lt;aspNetCore processPath="bin\IISSupport\VSIISExeLauncher.exe" arguments="-argFile IISExeLauncherArgs.txt" stdoutLogEnabled="false"&gt;
          &lt;environmentVariables /&gt;
        &lt;/aspNetCore&gt;
      &lt;/system.webServer&gt;
    &lt;/location&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><em>Note: I still get the same error message if I hardcode the full path in the processPath, or use <code>.\</code> relative pathing</em></p>
  
  <p>If I remove the <code>&lt;aspNetCore&gt;</code> node, I get a different error:</p>
  
  <blockquote>
    <h1>HTTP Error 502.3 - Bad Gateway</h1>
    
    <p><strong>There was a connection error while trying to route the request.</strong></p>
    
    <p><strong>Detailed Error Information:</strong>  </p>
    
    <p><strong>Module</strong>       AspNetCoreModule<br>
    <strong>Notification</strong>     ExecuteRequestHandler<br>
    <strong>Handler</strong>      aspNetCore<br>
    <strong>Error Code</strong>       0x80070490<br>
    <strong>Requested URL</strong>    <a href="http://localhost:80/IisTestApp" rel="noreferrer">http://localhost:80/IisTestApp</a><br>
    <strong>Physical Path</strong>    C:\Code\Sandbox\IisTestApp\IisTestApp<br>
    <strong>Logon Method</strong>     Anonymous<br>
    <strong>Logon User</strong>       Anonymous</p>
  </blockquote>
  
  <p>The point being that the <code>AspNetCoreModule</code> throws the error this time, so it <em>is</em> being loaded and running some code.</p>
  
  <p>Publishing to a separate folder and manually setting up the site in IIS (rather than relying on the default Visual Studio behavior of create an IIS website pointed at the "bin" folder) results in the same error message, although I get a slightly different <code>aspNetCore</code> node in the generated web.config file:</p>
  
  <pre><code>&lt;aspNetCore processPath="dotnet" arguments=".\IisTestApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"&gt;
    &lt;environmentVariables /&gt;
  &lt;/aspNetCore&gt;
  </code></pre>
  
  <p><strong>What is causing IIS to fail to run this application?</strong></p>
  
  <p>I have tried re-installing .NET Core (SDK, runtime, and hosting component) but it did not help.  </p>
  
  <p>I also noticed several posts that mention installing the URL Rewrite module for IIS corrects this error (notably this: <a href="https://stackoverflow.com/questions/13532447/http-error-500-19-iis-7-5-error-0x8007000d">HTTP Error 500.19 - IIS 7.5 Error 0x8007000d</a>).  My web.config doesn't mention that module, but I tried installing it in case the AspNetCoreModule uses it under the covers.  This did not help in my situation.</p>