title: ASP.NET Core + Framework in IIS getting HTTP 404
body: <p>Ok - this is my first deployment of an ASP.NET Core app.  One wrinkle to keep in mind is that I am using ASP.NET Core 2.2 and targeting Framework version 4.6.2 (not .Net Core).  It all runs fine on my local machine with VS2017 and IISExpress.</p>
  
  <p>I went through the procedure outlined by MS here: <a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2" rel="nofollow noreferrer">Host ASP.NET Core on Windows with IIS</a>  The documentation is long and complicated, but I think I covered everything.  It makes one thing clear: <strong>The in-process hosting model isn't supported for ASP.NET Core apps that target the .NET Framework.</strong>  So, I know I need to use Out-of-Proc.
  Some other points:</p>
  
  <ul>
  <li>I published the app to a local folder and copied it to the server without any changes.</li>
  <li>I created the new app in the Default Web Site and gave it its own app pool - set as "No Managed Code"</li>
  <li>Out-of-proc is the default, so I have not done any special config for this.</li>
  <li>I have confirmed that AspNetCoreModuleV2 appears in the list of Modules.</li>
  </ul>
  
  <p><strong>The Result</strong></p>
  
  <p>Every page I hit I get HTTP404.  I am running IE locally on the server and using a URL like: <a href="http://localhost/MyApp/Home/MyView" rel="nofollow noreferrer">http://localhost/MyApp/Home/MyView</a></p>
  
  <ul>
  <li>The application pool shows having 1 application running.</li>
  <li>The App Event Log shows a message like: Application '/LM/W3SVC/2/ROOT/MyApp' started process '8864' successfully and process '8864' is listening on port '37706'.  It shows no errors.</li>
  <li>I have tried adding a default.htm file to the root of the app and loading the static page directly (using <a href="http://localhost/MyApp/default.htm" rel="nofollow noreferrer">http://localhost/MyApp/default.htm</a>).  This gives 404.  If I remove the web.config, this page will load.</li>
  </ul>
  
  <p>I really didn't expect deploying the app to be this complicated.</p>
  
  <p>Can anyone provide any guidance on how to troubleshoot or fix this problem?</p>
  
  <p><strong>Update 1</strong>: Web.config is below.  I have tried with and without hostModel=...  aspNetCore logs show successful startup.  Nothing is added to the log with each page access attempt (seems weird)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;!--
      Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
    --&gt;
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /&gt;
        &lt;remove name="BlockViewHandler" /&gt;
        &lt;add name="JavaScript" path="*.js" verb="GET,HEAD" type="System.Web.StaticFileHandler" /&gt;
        &lt;add name="CSS" path="*.css" verb="GET,HEAD" type="System.Web.StaticFileHandler" /&gt;
        &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
      &lt;aspNetCore processPath=".\My.App.Name.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess"&gt;
        &lt;environmentVariables /&gt;
        &lt;handlerSettings&gt;
          &lt;handlerSetting name="debugLevel" value="file" /&gt;
          &lt;handlerSetting name="debugFile" value="d:\Log\MyApp.log" /&gt;
        &lt;/handlerSettings&gt;
      &lt;/aspNetCore&gt; 
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  &lt;!--ProjectGuid: ee76911e-decb-48b7-bd74-36ebfbdb22b6--&gt;
  </code></pre>