title: ASP.NET Core - Cannot serve static files - only default
body: <p>Basic ASP.NET Core 2.1 web app. </p>
  
  <p><code>Startup.cs</code> contains the following: </p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      app.UseStaticFiles();
      app.UseMvc();
  }
  </code></pre>
  
  <p>In this scenario, when I try to browse to any HTML file in the webroot directory (i.e. project-dir / wwwroot), it does not get served. The webroot directory contains an <code>index.html</code> file and an 2nd HTML file. None can be served by typing the URL.</p>
  
  <p>If I change <code>Startup.cs</code> to include default files like so: </p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      app.UseDefaultFiles();
      app.UseStaticFiles();
      app.UseMvc();
  }
  </code></pre>
  
  <p>then the <code>index.html</code> file gets served. Even if I type the name of the other HTML file I get the <code>index.html</code> file (which is per the docs). So apparently the URL writer invoked by <code>UseDefaultFiles()</code> manages to handle this correctly but why is it not working by direct URL?</p>
  
  <p>EDIT
  I said above "when I try to browse to any HTML file in the webroot" but in fact I did not try "any" file but the ones I was working on which either had names like exports.html, index.html or files in a subfolder called "core". See my answer below for what I found.</p>