iis – Simulate domains locally in ASP.NET /IIS7 – Education Career Blog

I would like to simulate that my ASP.NET application is hist by say simdomain.com.

How can i do that easily?

Ideally I would like some kind of filter, so requests to certain domains are routed to localhost, and it should be easy to turn it on and off.

,

Edit the hosts file.

  1. Run notepad c:\windows\system32\drivers\etc\hosts
  2. Add the following line:

    127.0.0.1 simdomain.com

  3. Open IIS admin and add a “simdomain.com” website. So it knows the domain.

,

Try editing you local hosts file. The default location is %SystemRoot%\system32\drivers\etc\hosts in most Windows systems.

Then you simply add the line

127.0.0.1       simdomain.com

That should do it.

EDIT: Ah, and as Chakrit said: Open IIS admin and add a “simdomain.com” website. So it knows the domain.

This depends a bit on IIS version, but if I remember correctrly for IIS7 do as follows:

  1. Run ‘inetmgr’, or access the IIS setings via the Control Panel.
  2. In the menu on the left open ‘Sites’, and right-click on the site you want to access. Choose ‘Edit bindings..’
  3. Click add. Type: Http, IP Address: All Unassigned, Port: 80, Host name: simdomain.com then click OK.

Might as well make my answer correct, even if the post is a tad redundant. 😉

,

Maybe have a read of this SO discussion; “ASP.NET Development server or localhost IIS”

Leave a Comment