title: I can only serve one file with OWIN UseStaticFiles
body: <p>I'm using OWIN to be able to serve static content over http from within a Windows Service.
  (To embed a Web Administration Tool for the Windows Service).</p>
  
  <p>I experience some strange behaviour:</p>
  
  <ul>
  <li>When I run the service, I can only access <strong>one</strong> file that is in the "web" folder, <strong>every consecutive call</strong> results in the browser telling that the page is <strong>not available</strong> (ERR_CONNECTION_RESET).</li>
  <li>The embedded WebApi <strong>stays accessible</strong>.</li>
  <li>When I restart the service with the same address and port, the files stay invisible.</li>
  <li>When I restart the service on another port, I can access a file <strong>once</strong>...</li>
  </ul>
  
  <p>By the way, this files in this "web" folder are set to "Copy always" for the "Copy to Output Directory" property.</p>
  
  <p>Anyone knows what is going wrong?</p>
  
  <p>See here my StartUp configuration class</p>
  
  <pre><code>public class WebStartUp
  {
      public void Configuration(IAppBuilder app)
      {
          string staticFilesDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "web");
          app.UseStaticFiles(staticFilesDir);
  
          HttpConfiguration config = new HttpConfiguration();
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
          app.UseWebApi(config);
      }
  }
  </code></pre>
  
  <p>See here my Windows Service that hosts it...</p>
  
  <pre><code>    public partial class MyService : ServiceBase
      {
          private IDisposable webApp;
          private const string ServiceAddress = "http://localhost:2345";
  
          public MyService()
          {
  
          }
  
          protected override void OnStart(string[] args)
          {
              InternalStart();
          }
  
          internal void InternalStart()
          {
              webApp = WebApp.Start&lt;WebStartUp&gt;(url: ServiceAddress);
          }
  
          protected override void OnStop()
          {
          }
  
          public static void Main()
          {
  #if DEBUG
              var service = new MyService();
              Console.WriteLine("starting");
              service.InternalStart();
              Console.ReadLine();
  #else
              ServiceBase[] ServicesToRun;
              ServicesToRun = new ServiceBase[] {
                  new RaceManagerService();
              }
              ServiceBase.Run(ServicesToRun);
  #endif
  
          }
      }
  </code></pre>