title: Dotnet Core 3.1 HTTP Error 500.19 - Internal Server Error
body: <p>I was trying to create a simple (default) Web API using <strong>dotnet core 3.1</strong> in Visual Studio 2019 using "ASP.NET Core Web Application".</p>
  
  <p>Once I created the (default) application and <strong>I was able to run it on IIS Express</strong> by pressing F5 in Visual Studio.</p>
  
  <p>Then I want to publish so I went to windows features and turned on IIS then configured it by installing <strong>"WebPlatformInstaller_x64_en-US.msi"</strong> and <strong>"dotnet-hosting-3.1.2-win.exe"</strong> (for dot net core). </p>
  
  <p>Then I ran the following in command prompt:</p>
  
  <pre><code>net stop was /y
  net start w3svc
  </code></pre>
  
  <p>I did the <strong>publish</strong> using <strong>"Default Web Site/Test"</strong> configuration pointing to host: <a href="http://localhost" rel="nofollow noreferrer">http://localhost</a> and Self Contain Package with DotNet Core 3.1.</p>
  
  <p>Also created a Application pool with <strong>"No Managed Code"</strong></p>
  
  <p><a href="https://i.stack.imgur.com/jD36b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jD36b.png" alt="Application Pool"></a></p>
  
  <p>When I went to <a href="http://localhost/Test" rel="nofollow noreferrer">http://localhost/Test</a>
  <strong>I got the following error message:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/hOBon.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hOBon.png" alt="Error Message"></a></p>
  
  <p>Here is my <strong>Web.Config</strong>:</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="AspNetCoreModuleV2" resourceType="Unspecified" /&gt;
    &lt;/handlers&gt;
    &lt;aspNetCore processPath="dotnet" arguments=".\TestApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /&gt;
      &lt;/system.webServer&gt;
    &lt;/location&gt;
  &lt;/configuration&gt;
  &lt;!--ProjectGuid: 63addee1-2c1f-4679-94f4-df9dc952d8f9--&gt;
  </code></pre>
  
  <p>I'm not sure if this is relevant information, when I did Pass-through Authentication test in IIS I'm getting the following:</p>
  
  <p><a href="https://i.stack.imgur.com/ntLxF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ntLxF.png" alt="Pass-through Authentication Test Results"></a></p>
  
  <p>I tried so many different ways of publishing and they all at the end getting the above error message. How can we resolve this?</p>