title: Self host asp core - angular 2 site with OWIN as console app
body: <p>I have built an Angular project with ASP net core 2 and angular and I have been trying to host it in OWIN to no avail. I used VS publish to generate the files to publish which works fine when run in IIS express directly from Visual Studio.</p>
  
  <p>This is the file structure for the publish folders:</p>
  
  <pre><code>MainDirectory
      wwwroot
         dist
         favicon
  </code></pre>
  
  <p>I have setup a publish project in .NET (Visual Studio) and have the following in my startup.cs class but when I browse to the url after starting the service, there is nothing in the page: I used this code below.</p>
  
  <pre><code>const string rootFolder = "C:\\src\\StartupService\\maindirectory";
              var fileSystem = new PhysicalFileSystem(rootFolder);
              var options = new FileServerOptions
              {
                  EnableDefaultFiles = true,
                  FileSystem = fileSystem
              };
  
              app.UseFileServer(options);
  </code></pre>
  
  <p>I want to mention that I tested the OWIN self host server with the app.UseWelcome() page in C# and it was fine but it won't serve my angular site. Just to mentioned that I don't see any html files in the publish folder anywhere, just DLLs, JSON files and web.config, so I don't know if that's a problem.</p>
  
  <p>I also tried this code, but it didn't work too.</p>
  
  <pre><code>var physicalFileSystem = new PhysicalFileSystem("C:\\src\\StartupService\\maindirectory");
              var options = new FileServerOptions
              {
                  EnableDefaultFiles = true,
                  FileSystem = physicalFileSystem,
                  StaticFileOptions =
                  {
                      FileSystem = physicalFileSystem,
                      ServeUnknownFileTypes = true
                  },
                  // DefaultFilesOptions = {DefaultFileNames = new[] {"index.html"}}
              };
              app.UseFileServer(options);
  </code></pre>
  
  <p>Any idea how to self host an Angular 2 created with VS2017 in OWIN?</p>