title: Map domain to IIS7 virtual directory in localhost
body: <p>I have 2 asp.net projects. An API and a web client project. When testing, I need to overcome the same origin policy so I cannot test with them on different ports.</p>
  
  <p>I used visual studio to map the api to: <code>http://localhost/api</code> but the other project cannot be mapped to <code>http://localhost/</code>. The reason I require it to be the root is because the applications contain references(forms, scripts, etc) to <code>/</code> the root. After doing some reading, I need to publish to <code>wwwroot</code>, which I dont want to do.</p>
  
  <p>My next option I assume is to map a domain to my virtual directories <code>http://localhost/web</code> and <code>http://localhost/api</code> => <code>someDomain.com</code> and <code>someDomain.com/api</code>. How do I do this? Editing the host files doens't work:</p>
  
  <pre><code>http://localhost/web    app.com
  http://localhost/api    api.app.com
  </code></pre>
  
  <p>Problems (solving either one will work for me):</p>
  
  <ol>
  <li>Point <code>http://localhost/</code> to <code>http://localhost/web</code> to solve the referencing problem.</li>
  <li>Create my virtual directory in <code>http://localhost/</code>;
  <img src="https://i.stack.imgur.com/A4Vpw.jpg" alt="enter image description here"></li>
  <li>Map a domain to the localhost virtual directories.</li>
  </ol>