Search code examples
webmatrixiis-express

WebMatrix Host File


Is there any way to do a redirect to a WebMatrix address like you would using a host file: 127.0.0.1 localwebsite.com.

I can't use computername:2000 in the host obviously, so how can I use my localwebsite.com with WebMatrix/IIS Express?


Solution

  • From Stefan Schackow:

    You need to tweak some local machine settings to allow IIS Express to bind to port 80. As long as you can’t use port 80, all of your local Urls will have “:port#” in the Url, which defeats the ability to run arbitrary hostnames against the web server by way of faking out DNS with your local HOSTS file.

    I see there is an article on learn.iis.net that explains how to ACL http.sys to allow IIS Express (and other apps) access to port 80: http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/ The section titled “Using a Reserved Port” has the info. Once you have done that, you should be able to do the usual tricks with the local HOSTS file, as well as configuring websites with specific host headers in IIS Express – and everything should work.

    -Stefan