Like its predecessors, IIS7 does not support wildcard (catch-all) binding or wildcards for host names, see this discussion for the state of things and how the much requested feature didn’t make it into the II7 release version as it stands. So, if you try to add *.yourdomain.com as a host name in IIS 7 you will get this warning:
There is only one “workaround” at the web server level and it requires a dedicated IP address for the particular site:
Set up a wildcard host record in DNS: right-click the zone yourdomain.com in DNS Manager>>New Host (A or AAAA)>>enter asterisk as wildcard and the dedicated IP address:
Then create you site in IIS without any host name:
This way DNS effectively takes care of the mapping of the URLs, throwing everything at the bound IP address which is pointing to your site. Here’s hoping that IIS will someday catch up with Apache and allow more flexible wildcard mapping of host names.
October 7th, 2008 at 10:23 am
Подскажите шооблончег под Wordpress 2.6.2, чтобы был похож на ваш dirk.net.
Заранее благодарю)
February 15th, 2009 at 12:50 pm
[...] Hallo, Ich habe das selbe problem: Dirk.Net Blog Archive Wildcard Host Header Binding And Subdomains with IIS7 Alle Requests *.name.dyndns.com werden auf meinen Server weitergeleitet, wenn ich einer Site einen [...]
August 21st, 2009 at 2:20 pm
Thanks for writing this up, I’ve been looking into this today and find it so frustrating that despite what seems to be a large community backing for the feature M$ still haven’t got around to building something in.
Cheers,
Rob
August 28th, 2010 at 4:45 am
But, you *can* do it at another level.
Proceed as posted in the blog post, then use httpcfg.exe to restrict the binding to only the wildcard.
It’s a question of *where* you bind it.
November 24th, 2010 at 6:25 pm
[...] If you can ensure the site only receives traffic on one IP and you own/have dedicated access to the server, you can use DNS to “fake” out the behavior with a wildcard mapping and no host. There is a great post on this at http://dirk.net/2008/05/28/wildcard-host-header-binding-and-subdomains-with-iis7 [...]
December 29th, 2010 at 10:42 am
hi
thank you very much for your solution
but , is there any security issue or traffic overhead problem with this method?
if yes ? what should we do ?
thanks again
December 30th, 2010 at 2:53 am
Hello reza, thanks for your comment.
Apache has the wildcard bindings but IIS7 doesn’t, and there might be reasons for this, and the reasons might be those you stated, security and “uncertainty” for clients, search engines etc. Google and other search engines certainly won’t like this uncertainty and it will always better to create fixed DNS entries and host definitions if you can.
March 1st, 2011 at 5:22 pm
Not exactly. While not perfect, you can use a wildcard host header on one website on your IIS installation without the dedicated IP address.
Refer to this image…
http://content.screencast.com/users/pblanton/folders/Jing/media/12315692-57df-4413-ad47-1498daeca989/2011-03-01_0828.png
I simply added ‘*’ as the hostname on the main website on my server. Since host headers must be unique, you can only do this on one website.
With your DNS set up correctly, any request to an unmapped subdomain, will be mapped to the main site. Go ahead and try it. Browse to http://boogerflicker.phasepoint.net. No, I don’t have a DNS entry for boogerflicker.phasepoint.net. If you don’t believe me. make up a different subdomain to phasepoint.net and give it a shot.
March 31st, 2011 at 10:33 pm
You can flag the wildcard at your registrar, if they host your domains’s dns, and leave the binding open on IIS. You don’t need dns running on the server.
August 18th, 2011 at 8:51 pm
[...] If you can ensure the site only receives traffic on one IP and you own/have dedicated access to the server, you can use DNS to “fake” out the behavior with a wildcard mapping and no host. There is a great post on this at http://dirk.net/2008/05/28/wildcard-host-header-binding-and-subdomains-with-iis7 [...]
February 3rd, 2012 at 6:45 am
I’ve added a feature request here for wildcard hostheaders: https://connect.microsoft.com/WindowsServerFeedback/feedback/details/722874/wildcard-subdomain-hostheader-support-in-iis-7-5
December 26th, 2012 at 9:27 pm
its useful for me…thank you for you kind informations