title: Return HTML view in .NET Core Console application with Kestrel
body: <p>I've got .Net Core Console application. I've been trying for awhile to make it possible to run <code>Process</code> and listen to <code>port</code> at the same moment and this was my way of doing it:</p>
  
  <p>This is my <code>program.cs</code> class:</p>
  
  <pre><code> class Program
  {
      static void Main(string[] args)
      {
          var ConsOut = Console.Out; 
          Console.SetOut(new StreamWriter(Stream.Null));
          BuildWebHost(args).Start();                    
          Console.SetOut(ConsOut); 
          while (true)
          {
              RunIbit();
          }
      }
  
      public static IWebHost BuildWebHost(string[] args)
      {
          var config = new ConfigurationBuilder()
              .SetBasePath(Directory.GetCurrentDirectory())
              .AddJsonFile("appsettings.json", optional: true)
              .AddCommandLine(args)
              .Build();
  
          var host = new WebHostBuilder()
              .UseKestrel()
              .UseConfiguration(config)
              .UseStartup&lt;Startup&gt;()
              .UseIISIntegration()
             .Build();
  
          return host;
      }
  
  
      public static void RunIbit()
      {
          // Execute Proccess.Start();
      }}
  </code></pre>
  
  <p>and here is <code>Startup.cs</code>:</p>
  
  <pre><code>public class Startup
  {
      public Startup()
      {
          var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
          Configuration = builder.Build();
      }
  
      public IServiceProvider ConfigureServices(IServiceCollection services)
      {
          services.AddSingleton&lt;IHttpContextAccessor, HttpContextAccessor&gt;();
          services.AddLogging();
          var serviceProvider = services.BuildServiceProvider();
          services.AddSingleton&lt;IConfigurationRoot&gt;(Configuration);
  
          return WindsorRegistrationHelper.CreateServiceProvider(ContainerManager.Container, services);
      }
       public void Configure(IApplicationBuilder app){
          app.Run(context =&gt; {
              return context.Response.WriteAsync("Hello world");
          });
       }
  }
  </code></pre>
  
  <p>Since I want to show the results of the process in a web page I've been wondering whether it's possible to do that somehow instead of writing that <code>Hello world</code>?
  Tried adding <code>app.UseMvc()</code> instead of <code>app.Run(context =&gt; {
                  return context.Response.WriteAsync("Hello world");
              });</code> but it didn't work with .net core console application and this was the only that worked for me (or at least the one I found) but I couldn't find how to replace that text with html file. Does anyone know a way?</p>