Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

VS.NET - using host headers for testing URL

Here's my setup:

Laptop running Windows Server 2003, Visual Studio .NET 2003, and VSS for source control.  I am trying to set my machine up to mirror the live server as much as possible.  I am using host headers like http://local-site1/ rather than localhost.  I have it confirgured to the point where I can type that URL into a browser and pull up the site.

What I am trying to do is open the project from source control and use http://local-site1/ as my working copy, rather than http://localhost/site1 as it defaults.

I have a handful of web applications I need to manage, and I want to be able to have their root-relative paths work exactly the same from local to dev to live, without having to remember to change a config file before deployment.

Anyone have experience with doing this?

Monday, February 28, 2005

I think that you can´t do this to manage many sites, but, you can use a DNS Server locally to manage better, because will not necessary use http://server/resource, but only http://dnsdomain

Leonardo Nunes
Tuesday, March 01, 2005

OK, I think I figured this out.  Here are the steps I took (remember, this is on Windows Server 2003, as XP will not let you do some of this stuff):

1. "Open from Source Control" in VS.NET to create the initial project.  Start with a clean slate and let VS create your folders and stuff.  Allow it to select the localhost working copy location.

2. In IIS Manager, create a new website with your custom host header (faux domain name) that points to the folder VS created.

3. Open C:\WINDOWS\system32\drivers\etc\hosts in Notepad and add a new line (site1 == your cute domain name):    site1

4. In Internet Explorer, add the new faux domain to your list of trusted sites (Tools->Internet Options->Security).  Set the custom level for Trusted Sites zone to all automatic logon with current username and password (this is necessary for the debugger to work).

5. Using Notepad, open the *.vbproj.vspscc and *.vbproj.webinfo files [within the specific root folder for that web project] to change the UNC path from localhost to the new domain.

During my arduous troubleshooting process, I also added my local machine account and the ASPNET account to the Debugger Users group on my machine, so if you are trying this and run into issues with debug permissions, try doing that.

Hopefully this is useful for others in this situation.


Tuesday, March 01, 2005

*  Recent Topics

*  Fog Creek Home