Web site host with url in iis

2.6k Views Asked by At

I'm going to host a web site in one of my computers toaccess it from the another computer. (Same local network) This what I have done so far.

Step 1 : Host the web site in IIS.

Step 2 : Using "Edit bindings" I changed the host name.

enter image description here

Step 3 : Then I changed the host file located at "C:\Windows\System32\drivers\etc"

   192.168.8.100   mylocalhost.com

Step 4 : Turn off both private and public windows firewalls. (I know this is bad. But for now its fine. I can add inbound rules after resolving this issue)

I try to access to the url http://mylocalhost.com:8082 using hosted environment. It is success, but when I try to access that url from the other computer(in the same local network) it cannot be access. Without the above binding name (mylocalhost.com), I can access to the web site using http://192.168.8.100:8082

I want to access to the website using a url with any computer/mobile device connected to the local network. Can anyone show me a direction to resolve my issue?

Environment Information

  • Windows 10
  • IIS (version 10)
1

There are 1 best solutions below

2
On

Your problem is step 3 - your assumption that the host file on a single client computer will apply to all computers on your network. You need a server of some description for the behaviour you describe.

A hosts file is only used by that single computer to resolve or override dns. Each computer has it's own file and there is no default way of sharing this file with other computers on the network. Your choices are:

  1. Add the host file entry to each device.
  2. Setup a DNS server. your router might support this, and is likely providing the DNS server to your clients via DHCP so no additional config would be nessersary. Just login to its web interface and configure the dns name. If your router cant do it for you you would need a DNS service running on one of your computers and then configure either your routers dhcp/dns to use this new DNS service, or manually configure all clients to use the new DNS for their DNS resolution.
  3. Setup an active directory server and join all your pcs to the domain (setting up AD includes a DNS server).
  4. Some Public DNS providers allow you to specify a private ip in public dns. So assuming you owned the domain example.com you might be able to create an A record my.example.com for your 192.168.8.100 ip address. This would be public, but only devices on your private network would actually be able to connect to your server (ie different physical computers/networks that happen to use the same internal ip).