title: Visual Studio Local IIS Web Server Project Url With Multiple Subdomains
body: <p>I would like to try testing virtual hosting of an ASP.Net MVC website on my local machine.  In Visual Studio in the <strong>Web</strong> tab of the properties file for the MVC project, I selected <strong>Use Local IIS Web Server</strong>.  By "virtual hosting", what I really mean is that I'm trying to make sure that pages load correctly for urls of the form <a href="http://sub-domain-i.my-domain.com/MyMvcProject/Controller/Action" rel="nofollow">http://sub-domain-i.my-domain.com/MyMvcProject/Controller/Action</a>, where I'm hoping to test multiple subdomains in place of sub-domain-i.  In production, everything will be running under a single IP address on one server.  I also hope to test https for urls of this form using a wildcard ssl certificate, but currently I'm having trouble configuring Visual Studio to just test regular http.  Prior to worrying about sub-domains, the <strong>Project Url</strong> field in the <strong>Web</strong> tab of the properties folder for my MVC project said "http://localhost/MyMvcProject", and everything worked fine.  However, after changing this to "http://sub-domain-1.my-domain.com/MyMvcProject" and then adding the following line into my C:\Windows\System32\drivers\etc\hosts file,</p>
  
  <pre><code>127.0.0.1    sub-domain-1.my-domain.com
  </code></pre>
  
  <p>Visual Studio produces the error "Unable to create the virtual directory.  <a href="http://sub-domain-1.my-domain.com/MyMvcProject" rel="nofollow">http://sub-domain-1.my-domain.com/MyMvcProject</a>".  Does anyone know what I might be doing wrong?</p>
  
  <p>Many thanks in advance!</p>
  
  <p><strong>Edit:</strong>  I've just discovered that if I select <strong>Use Custom Web Server</strong> instead of <strong>Use Local IIS Web server</strong>, it works and I don't get the popup error from Visual Studio.  I'm still not sure why this solution works, though, or what I was doing wrong by selecting <strong>Use Custom Web Server</strong>...</p>