title: Running ASP.NET Core application in full IIS without publishing gives 502.5 error
body: <p>I'm trying to host an ASP.NET Core application in IIS on my local machine, and I'm getting a <code>502.5</code> error. <strong>My question is <em>different</em> from <a href="https://stackoverflow.com/q/38624453/419956">"ASP.NET Core 1.0 on IIS error 502.5"</a></strong> because I'm <em>not</em> publishing my app, but (for testing purposes) trying to have IIS (not express) on my dev machine serve up the app.</p>
  
  <p>To reproduce:</p>
  
  <ol>
  <li>Open VS2017</li>
  <li>Create a new <code>ASP.NET Core Web Application (.NET Core)</code></li>
  <li><p>Choose the "Web API" template and target "ASP.NET Core 1.1" (no authentication)</p>
  
  <p>Your <code>Main</code> looks like this now:</p>
  
  <pre><code>public static void Main(string[] args)
  {
      var host = new WebHostBuilder()
          .UseKestrel()
          .UseContentRoot(Directory.GetCurrentDirectory())
          .UseIISIntegration()
          .UseStartup&lt;Startup&gt;()
          .UseApplicationInsights()
          .Build();
  
      host.Run();
  }
  </code></pre>
  
  <p>Your csproj looks like this:</p>
  
    
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp1.1&lt;/TargetFramework&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;Folder Include="wwwroot\" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre></li>
  <li><p>Hit F5 to run and <code>localhost:6565/api/values</code> open up</p></li>
  <li>Add a "Web Configuration File" to the root of the project</li>
  <li><p>Uncomment the <code>system.webServer</code> section looking like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;remove name="aspNetCore"/&gt;
        &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/&gt;
      &lt;/handlers&gt;
      &lt;aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /&gt;
  &lt;/system.webServer&gt;
  </code></pre></li>
  <li><p>Open the IIS Manager GUI</p></li>
  <li>Choose "Add Website", pick a name and a port, set the path to the folder where the <code>web.config</code> is located</li>
  <li>As per <a href="https://docs.microsoft.com/en-us/aspnet/core/publishing/iis" rel="nofollow noreferrer">Microsoft's instructions</a> set the Application Pool's ".NET CLR version" to "No Managed Code"</li>
  <li><p>Browse to your new application, e.g. <code>http://localhost:8089/api/values</code></p>
  
  <p>Result: HTTP Error 502.5 - Process Failure<br>
  Expected: same result as in step 4.</p></li>
  </ol>
  
  <p>I've tried to exclude all causes mentioned in <a href="https://stackoverflow.com/a/38670738/419956">the top answer</a> to the other question:</p>
  
  <ul>
  <li>Set <code>LocalSystem</code> identity for the app pool</li>
  <li>Check on the console if <code>dotnet --version</code> runs (i.e. is available on the PATH)</li>
  </ul>
  
  <p>In addition I've tried a few other things:</p>
  
  <ul>
  <li>Set <code>processPath</code> to variations of <code>"%LAUNCHER_PATH%\bin\Debug\netcoreapp1.1\WebApplication1.dll</code></li>
  <li>Set <code>processPath</code> to point to <code>dotnet.exe</code> or its location</li>
  <li>Re-read <a href="https://docs.microsoft.com/en-us/aspnet/core/publishing/iis" rel="nofollow noreferrer">the docs</a> to distill a way to do this.</li>
  </ul>
  
  <p>With ASP.NET MVC applications on the .NET Framework you could just spin up a new Website in full IIS that points to the MVC project's folder and it would "just work". </p>
  
  <p>What do you need to do to get this to work with ASP.NET Core? Is it even possible to get this flow working without publishing?</p>