title: Self hosting Web Api service into Windows Forms
body: <p>I am trying to self host a Web Api service inside a windows forms application using the code below</p>
  
  <pre><code>namespace MascoteAquarium.Desktop
  {
      static class Program
      {
          /// &lt;summary&gt;
          /// The main entry point for the application.
          /// &lt;/summary&gt;
          [STAThread]
          static void Main()
          {
              var config = new HttpSelfHostConfiguration("http://localhost:8080");
              config.Routes.MapHttpRoute(
                  "DefaultApi", "api/{controller}/id", new { id = RouteParameter.Optional });
  
              using (HttpSelfHostServer server = new HttpSelfHostServer(config))
              {
                  server.OpenAsync().Wait();
              }
  
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              Application.Run(new frmMainMenu());
          }
      }
  }
  </code></pre>
  
  <p>When I try</p>
  
  <pre><code>http://localhost:8080/api/*(some-controller)* 
  </code></pre>
  
  <p>I receive a <em>NullReferenceException</em> at <em>System.Web.Http.SelfHost.HttpSelfHostServer.ProcessRequestContext(ChannelContext channelContext, RequestContext requestContext)</em></p>
  
  <p>Someone know what is happening? Is it possible to self host inside a Win Forms app?</p>