title: HTTP Error 500.31 - Failed to load ASP.NET Core runtime
body: <p>I'm having issues deploying .NET Core applications to IIS on a Windows 10 machine.</p>
  <p>When I deploy to IIS and navigate to the site I recieve the message:</p>
  <pre><code>&quot;HTTP Error 500.31 - Failed to load ASP.NET Core runtime
  Common solutions to this issue:
  The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
  Troubleshooting steps:
  Check the system event log for error messages
  Enable logging the application process' stdout messages
  Attach a debugger to the application process and inspect
  For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526
  </code></pre>
  <p>In my event viewer, every call to the page generates 3 error messages.</p>
  <ol>
  <li>
  <blockquote>
  <p>Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.</p>
  </blockquote>
  </li>
  <li>
  <blockquote>
  <p>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:</p>
  </blockquote>
  </li>
  <li>
  <blockquote>
  <p>Failed to start application '/LM/W3SVC/4/ROOT', ErrorCode '0x8000ffff'.</p>
  </blockquote>
  </li>
  </ol>
  <p>On these alone, I'd go down the rabbit hole of thinking there's some issue in the build of the project or perhaps my installation of some .NET Core package except:</p>
  <ol>
  <li>I have two other .NET Core 3.1 sites running at different ports.  In fact, if I copy the files from the directory of a working site, to the directory of a non-working site they will not run through IIS.  If I copy files from the directory of a non-working site, to a working site, those files will run through IIS.</li>
  <li>If I click on the executable for any of the sites and navigate to the specified localhost, they open up in a web browser just fine.</li>
  <li>I can run all manner of framework-dependent and Self-Contained .Net Core 3.1 and .Net Core 5.0 console apps anywhere on the same system.</li>
  <li>The two sites that do work, showed the same error message the first time I went to publish. I tried adjusting settings, reinstalling runtimes and the like but failed to isolate anything that caused them to start running a few hours after the first attempt at deployment.</li>
  <li>There is no visibile difference in settings in the Application Pool or the sites themselves between the sites that work and the sites that don't.</li>
  </ol>
  <p>I think there must be some issue with how I've configured IIS, the sites, or the application pools, but as best I can tell there isn't any difference.  If anyone has encountered this, I'm all ears for suggestions.</p>