title: ASP.NET Core 2.0 app targeting .NET 4.6.1 fails to host on IIS
body: <h2>The problem</h2>
  
  <p>IIS ASP.NET Core module is unable to start an ASP.NET Core 2.0 app.</p>
  
  <p><strong>Browser:</strong> HTTP Error 502.5 - Process Failure</p>
  
  <p><strong>Windows Event Log:</strong> Application ‘<code>MACHINE/WEBROOT/APPHOST/AppSite</code>’ with physical root ‘<code>C:\inetpub\apps\AppFolder\</code>’ failed to start process with commandline ‘<code>C:\inetpub\apps\AppFolder\App.exe</code>’, ErrorCode = ‘<code>0x80004005: 1</code>’.</p>
  
  <p><strong>ASP.NET Core Module Log:</strong> Log file is created but is empty.</p>
  
  <hr>
  
  <h2>The setup</h2>
  
  <p><strong>App:</strong> ASP.NET Core 2.0 targeting .NET Framework 4.6.1. </p>
  
  <p><strong>Server:</strong> Windows Server 2012 R2 Standard 6.2.9200 with IIS 8.5.9600.</p>
  
  <hr>
  
  <h2>The story</h2>
  
  <p>We've created a blank MVC Web application using the default project templates provided in Visual Studio 2017.</p>
  
  <p>The app is deployed following the official specification: <a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/</a>.</p>
  
  <p>The confusion arises mainly from these <strong>two points</strong>:</p>
  
  <ol>
  <li>Running the app through command-line on Kestrel works. </li>
  <li>Running a different app but targeting .NET Core 2.0 and publishing as framework-dependant works flawlessly on IIS.
  <em>But between these two apps:</em> the codebase is the same, the IIS website and application pool is the same and we even emptied out the app directory and used the same one.</li>
  </ol>
  
  <p>Due to these points the only difference seems to be the net461 app's executable file.</p>
  
  <p>We do not have full control over the Windows Server where we're trying to deploy but we do have administrator accounts. The current assumption is that the issue lies within permissions - maybe AD group policies, antivirus blocking the file but we're still awaiting response from the client's sysadmins. Meanwhile we haven't been able to replicate the error code ‘<code>0x80004005: 1</code>’ while trying to setup these restrictions on our development machines.</p>
  
  <p>Here's an incomplete list of ideas and points about the issue we've tried while problem solving:</p>
  
  <ul>
  <li>The initial app (targeting net461) works flawlessly on IIS when
  deployed to other servers (Windows 10 Enterprise, Windows Server 2012
  R2 Datacenter).</li>
  <li>Reinstalling different versions of ASP.NET Core/.NET Core: Runtime &amp; Hosting Bundle.</li>
  <li>Setting NTFS permissions to the dotnet folder.</li>
  <li>Changing IIS application pool identity to an administrator account.</li>
  <li>Restarting the server.</li>
  <li>Going over local group and security policies.</li>
  <li>Going over the antivirus settings and logs.</li>
  <li>Trying to deploy on a brand new server (same OS, same bloat).</li>
  </ul>
  
  <p>All ideas/comments are greatly appreciated. The more obscure the better.</p>
  
  <p>EDIT:</p>
  
  <p>Since this got flagged as a possible duplicate of <a href="https://stackoverflow.com/questions/41857702/asp-net-core-0x80004005">ASP.NET Core 0x80004005</a> I need to specify why that is not a duplicate.</p>
  
  <ul>
  <li>That referenced project is an older version of ASP.NET Core (last use
  of project.json was in 2016)</li>
  <li>That referenced project targets .NET Core and not .NET 4.6.1. It is mentioned here as well that targeting .NET Core works on IIS in regard to this issue.</li>
  <li><p>Selected answer points out that they fixed it by:</p>
  
  <blockquote>
    <p>Turns out that this was result of needing to install some windows
    updates and this problem:</p>
    
    <p>api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft
    Office file</p>
    
    <p>Rather than install the version discussed in the above issue I whet
    into Programs and Features and ran a repair on Microsoft Visual C++
    2015 Redistributable.</p>
  </blockquote>
  
  <p>but the installation of Microsoft Visual C++ 2015 Redistributable is one of the steps in the official setup guide and it is mentioned here as well that the official guide has been followed during the setup process.</p></li>
  <li><p>We have gone over that post and tried to repair and reinstall the Microsoft Visual C++ 2015 Redistributable runtime components and this did not fix the issue.</p></li>
  </ul>