title: ASP.NET Core / Kestrel not serving static content consistently
body: <p><strong>Background Info:</strong></p>
  
  <ul>
  <li>ASP.NET Core v3.1 w/ RazorPages</li>
  <li>Works fine locally (Win10 &amp; Kestrel on localhost)</li>
  <li>Returns 404 for files in wwwroot/ <em>only</em> on deployment to Linux VM (Ubuntu 18), Bootstrap works fine locally, no 404s</li>
  <li>Publishing with <code>dotnet publish -r linux-x64</code></li>
  <li>The deployed app is running Kestrel and being forwarded requests from NGINX.</li>
  </ul>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre class="lang-cs prettyprint-override"><code>public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  {
      /// Included before other middleware (needed due to nginx forwarding)
      /// Per: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.1
      app.UseForwardedHeaders(new ForwardedHeadersOptions
      {
          ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
      });
  
      if (env.IsDevelopment())
      {
          app.UseDeveloperExceptionPage();
      }
      else
      {
          app.UseExceptionHandler("/Error");
          app.UseHsts();
      }
  
      app.UseHttpsRedirection();
      app.UseStaticFiles();
      app.UseRouting();
  
      app.UseCookiePolicy(); // -- Added for AaaS?
  
      app.UseAuthentication();
      app.UseAuthorization();
  
      app.UseEndpoints(endpoints =&gt;
      {
          // Added to allow controllers
          endpoints.MapControllers();
  
          // Original Razor Page way
          endpoints.MapRazorPages();
      });
  
  }
  </code></pre>
  
  <p><strong>_Layout_.cshtml</strong></p>
  
  <pre><code>&lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
      &lt;title&gt;@ViewData["Title"] - Title&lt;/title&gt;
      &lt;link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /&gt;
      &lt;link rel="stylesheet" href="~/css/site.css" /&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p><strong>partial layout of wwwroot/</strong>:</p>
  
  <ul>
  <li>css/
  
  <ul>
  <li>site.css</li>
  </ul></li>
  <li>js/
  
  <ul>
  <li>site.js</li>
  </ul></li>
  <li>lib/
  
  <ul>
  <li>bootstrap/
  
  <ul>
  <li>dist/</li>
  <li>css/
  
  <ul>
  <li>bootstrap.css</li>
  </ul></li>
  </ul></li>
  <li>jquery/</li>
  </ul></li>
  </ul>