title: .NET Core 2.0 Minimal WebHost with Routes
body: <p>I'm trying to create an absolute minimal WebHost targeting netcoreapp2.0.
  I've been refering to this without success: <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/hosting?tabs=aspnetcore2x" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/hosting?tabs=aspnetcore2x</a></p>
  
  <pre><code>using System;
  using Microsoft.AspNetCore;
  using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.AspNetCore.Routing;
  using Microsoft.AspNetCore.Http;
  
  namespace netcore_pi_project
  {
      class Program
      {
  
          public static void Main(string[] args)
          {
              BuildWebHost(args);
  
              using (var host = WebHost.Start(router =&gt; router
                  .MapGet("volu", (req, res, data) =&gt; 
                      res.WriteAsync($"ps aux".Bash()))
                  .MapGet("vold", (req, res, data) =&gt; 
                      res.WriteAsync($"ps aux".Bash()))))
              {
                  Console.WriteLine("Core Volume project running..");
                  host.WaitForShutdown();
              }
          }
  
          public static IWebHost BuildWebHost(string[] args) =&gt;
              WebHost.CreateDefaultBuilder(args)
                  .UseUrls("http://localhost:5000")
                  .Build();
      }
  }
  </code></pre>
  
  <p>This builds but won't run:</p>
  
  <blockquote>
    <p>Unhandled Exception: System.ArgumentException: A valid non-empty application name must be provided.
    Parameter name: applicationName
       at Microsoft.AspNetCore.Hosting.Internal.HostingEnvironmentExtensions.Initialize(IHostingEnvironment hostingEnvironment, String applicationName, String contentRootPath, WebHostOptions options)
       at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException&amp; hostingStartupErrors)
       at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
       at netcore_pi_project.Program.BuildWebHost(String[] args) in /Users/owe-macpro/projects/netcore-pi-project/Program.cs:line 31
       at netcore_pi_project.Program.Main(String[] args) in /Users/owe-macpro/projects/netcore-pi-project/Program.cs:line 17</p>
  </blockquote>