I'm building a site where businesses will be able to sign-up for there own account which should be located at http://businessname.example.com with the "businessname" changing each time.
I want to do this on a windows server (IIS 7) but am not sure how a go about it.
First, you have to configure your DNS server to resolve *.example.com to the IP of your server.
Then, you have two choices:
via http://forums.asp.net/t/874598.aspx
option 2 is probably what you are looking for (and is STRONGLY recommended and preferred to option 1).
more info about url rewriting on iis7: http://learn.iis.net/page.aspx/460/using-url-rewrite-module/
the url rewriting option makes it easy to have hundreds of thousands of companies, their names can be read from the database and a url rewrite will handle the redirects. after that you can forget about it (for the most part) as it will keep on working for all the companies signing up in the future as well.
This involves :
Once you programatically add the host name the wildcard mapping enables it to be resolved.
The URL Rewrite option would be cleaner, but with the physical domain, you could offer FTP Access and other things as it would be a full domain.
Andrew
Generally, the better approach to this (if possible) is to not use Host Headers or separate IIS sites for each signup. Simply dedicate an IP address to that application that responds to all requests on Port 80 (or whatever port you use) and let your application detect the host header on request. This way, if you have 1,000 signups you don't end up with 1,000 "things" that need to be configured properly at the OS/services layer.
Alternatively if you just want the code, not sure what language you're looking at, but see below for C#...
http://forums.iis.net/t/1151463.aspx