title: set base path in IISExpress and webapi in ASP.NET 5
body: <p>I need to have WebAPI project working under different base path than usual. I created simple project under Visual Studio that uses WebAPI and ASP.NET 5.</p>
  
  <p>Under base path set to <a href="http://localhost:38170/" rel="nofollow noreferrer">http://localhost:38170/</a> my project works fine and I'm able to get values from test controller (<a href="http://localhost:38170/api/values" rel="nofollow noreferrer">http://localhost:38170/api/values</a>).
  At this stage my IIS Express configuration is:</p>
  
  <pre><code>&lt;site name="WebApi" id="2"&gt;
      &lt;application path="/" applicationPool="Clr4IntegratedAppPool"&gt;
          &lt;virtualDirectory path="/" physicalPath="C:\WebApi\src\WebApi\wwwroot" /&gt;
     &lt;/application&gt;
     &lt;bindings&gt;
          &lt;binding protocol="http" bindingInformation="*:38170:localhost" /&gt;
     &lt;/bindings&gt;
  &lt;/site&gt;
  </code></pre>
  
  <p>I tried changing App URL under project properties to reflect my need:
  <a href="http://localhost:38170/xxx" rel="nofollow noreferrer">http://localhost:38170/xxx</a></p>
  
  <p>Now running project and hitting <a href="http://localhost:38170/xxx/api/values" rel="nofollow noreferrer">http://localhost:38170/xxx/api/values</a> results in 404. Trying <a href="http://localhost:38170/api/values" rel="nofollow noreferrer">http://localhost:38170/api/values</a> returns values from controller just as if nothing changed. I noticed that changes in Visual Studio are not reflected in IIS Express configuration (I don't know if they should be...) in any way.</p>
  
  <p>I tried changing path on IISExpress manually like in this thread: <a href="https://stackoverflow.com/questions/8735713/creating-virtual-directories-in-iis-express">Creating virtual directories in IIS express</a>.</p>
  
  <pre><code>&lt;site name="WebApi" id="2"&gt;
      &lt;application path="/" applicationPool="Clr4IntegratedAppPool"&gt;
          &lt;virtualDirectory path="/xxx" physicalPath="C:\WebApi\src\WebApi\wwwroot" /&gt;
     &lt;/application&gt;
     &lt;bindings&gt;
          &lt;binding protocol="http" bindingInformation="*:38170:localhost" /&gt;
     &lt;/bindings&gt;
  &lt;/site&gt;
  </code></pre>
  
  <p>The results are:</p>
  
  <p><a href="http://localhost:38170/api/values" rel="nofollow noreferrer">http://localhost:38170/api/values</a> - 500.19 Error (config error) and that is fairly ok - I don't plan this to work</p>
  
  <p><a href="http://localhost:38170/xxx/api/values" rel="nofollow noreferrer">http://localhost:38170/xxx/api/values</a> - 502.3 - Bad Gateway on hitting httpPlatformHandler</p>
  
  <p>I suppose that error is somewhere in httpPlatformHandler configuration but I'm not sure how to do it in conjuction with IIS Express. My web.config is:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/&gt;
      &lt;/handlers&gt;
      &lt;httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I tried random changes like changes in path attribute to <code>xxx/*</code> but nothing works.</p>
  
  <p>EDIT:
  To clarify the question. </p>
  
  <p>How to setup WebAPI on ASP.NET 5 (ASP.NET Core) on IISExpress using httpPlatformHandler and Kestrel to set base path other than root.</p>