Viewing my IIS hosted site on other machines on my network
Asked Answered
I

12

106

At home I have a simple network setup containing 2 machines.

On one machine i have a site hosted with IIS7. Rather than the standard localhost/index.htm address I have added an entry in the HOSTS file pointing the local IP (127.0.0.1) to this domain - www.mysite.dev.

I can access the site with www.mysite.dev with no problem.

what I would like to do is be able to view this site from my other machine on the network.

Initially I assumed this could be done with a URL like so MACHINE-NAME/www.mysite.dev, but the connection always times out. But I can ping MACHINE-NAME without problems.

For testing purposes I have disabled the windows firewall on both machines but to no joy.

Like a typical web developer, my hardware/network skills are pretty poor.

Can anyone see where I'm going wrong?

Intimist answered 2/2, 2010 at 12:39 Comment(1)
Have you tried just connecting to MACHINE-NAME ?Lemniscate
T
161

As others said your Firewall needs to be configured to accept incoming calls on TCP Port 80.

in win 7+ (easy wizardry way)

  1. go to windows firewall with advance security
  2. Inbound Rules -> Action -> New Rule
  3. select Predefined radio button and then select the last item - World Wide Web Services(HTTP)
  4. click next and leave the next steps as they are (allow the connection)

  • Because outbound traffic(from server to outside world) is allowed by default .it means for example http responses that web server is sending back to outside users and requests

  • But inbound traffic (originating from outside world to the server) is blocked by default like the user web requests originating from their browser which cannot reach the web server by default and you must open it.

You can also take a closer look at inbound and outbound rules at this page

Toreutics answered 4/1, 2011 at 19:56 Comment(9)
If it still doesn't work, then you can Turn off the firewall itself, at least for development environment.Oddment
@Contristo, my sentiments exactly :)Brita
I can not turn off the firewall, due to my company installed antivirus. Please tell me workaround for this i am using window 8Favien
@hitesh , you only need to open port 80 through your turned on firewall. if you do not have even permission to add ports you usually should ask related support team to open this port for this server for youToreutics
@Hitesh: you can host your site on port other than 80 and allow only that port for you. See my answer below on how to do it.Rabies
@DaMuffiner ahhhhhh yeah!Windburn
Quick access to Windows Firewall with Advanced Security: Win+R then type mmc.exe wf.msc.Houseline
how if I want to access my server use domain name,,, e.g example.com (for IP Address i can access server).Poaceous
Domain names are first resolved to IP by your domain controller. so maybe you shoud also add the IP of your domain controller or Domain Name Server here.Toreutics
R
37

If you're hosting website on a specific port in IIS like 4321 then you'd have to allow this port through Windows Firewall too. Here're the steps that I followed along with the imanabidi's answer to get it work for me:

  1. Windows Firewall > Advanced settings
  2. Inbound Rules > New Rule
  3. Select Port > Next
  4. Specific local ports > Add the Port you want to allow
  5. Allow All Connections
  6. Enter a name and some description so that you remember it later on
  7. Done
Rabies answered 17/8, 2015 at 17:29 Comment(0)
T
11

First of all, try to connect to the LAN IP of your server. If IIS is set up with only one web site, chances are that your site is going to pop up.

If you want to access it by name, you would have to add an entry in the HOSTS file of every client PC you want to view the site with (not to 127.0.0.1 obviously, but to the local IP address of your server).

Also, your Firewall needs to be configured to accept incoming calls on Port 80.

This is usually the point where it makes more sense to set up a DNS service that you can register names like "mysite.dev" with centrally, without having to dabble with hosts files. But that's a different story, and belongs to superuser.com or serverfault.com.

Torpedoman answered 2/2, 2010 at 12:42 Comment(1)
The firewall is the most important part here.Cockade
S
6

Open firewall settings. Then search for something like - Allow program or feature to allow through firewall. If in the list World Wide Web services (HTTP) is unchecked, check it and restart the system.

Our machine is all set to accept inbound requests.

Selectman answered 16/8, 2012 at 7:20 Comment(0)
L
4

In addition to modifying your firewall, don't forget to add port binding too!

Open $(SolutionDir)\.vs\config\applicationHost.config and find binding definitions, should be something like this

<sites>
    <site name="Samples.Html5.Web" id="1">
        <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="C:\Git\Samples.Html5.Web" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:63000:localhost" />
        </bindings>
    </site>
    ...
</sites>

Just add extra lines to reflect your machine IP and designated port

<bindings>
    <binding protocol="http" bindingInformation="*:63000:localhost" />
    <binding protocol="http" bindingInformation="*:63000:10.0.0.201" />
</bindings>

Source: https://blog.falafel.com/expose-iis-express-site-local-network/

Leporide answered 30/6, 2018 at 16:28 Comment(1)
Port Binding was an important step for me! I was using IIS Express which won't allow access via the IP address by default (only localhost). So without this step the higher rated answers weren't going to work for me!Erena
M
3

Very Late Answer but I will highlight some point as I had to deal with it years ago setting up my IIS site across network

  1. Both your machines should be connected to the same network (same wireless network is fine)
  2. Access your remote machine via IP 168.192.x.x or via http://his-pc-name (do not forget the http part)
  3. This will server the default IIS page on the remote machine (same that is served through localhost). If you want to server another site, [you have to make that default] first1.

Make sure your IIS is working fine on remote machine by checking localhost which should served the default site. Also make sure your firewall is configured to allow connection via port 80 or you can just disable firewall for the time being for testing purposes.

Monotype answered 7/6, 2016 at 5:3 Comment(1)
Using the IP instead of my workstation name worked. Cheers!Meggie
M
2
 Control Panel>System and Security>Windows Firewall>Allowed Programs-> then check all " World Wide Web Services(Http) tab". 

Its worked for me

Mcfarland answered 6/7, 2015 at 14:46 Comment(0)
J
2

It might be late, but for any other person who may get such an issue in future, for any connections you want to make to the server (in this case the machine that hosts the web application, regardless if it is iis or xampp) you need to allow connection or traffic through the specific port that will be used in the firewall

1. Go to Windows Firewall -> Advanced settings
2. Click Inbound Rules -> Then New Rule
3. Select Port -> Next
4. Specific local ports -> Add the Port you want to allow
5. Allow All Connections
6. Enter a name and a description for to help you remember later on

and you Done

Joab answered 10/5, 2018 at 6:5 Comment(0)
C
1

After installing antivirus I faced this issue and I noticed that my firewall automatically set as on, Now I just set firewall off and it solved my issue. Hope it will help someone :)

Cherianne answered 22/3, 2014 at 10:6 Comment(0)
S
0

127.0.0.1 always points to localhost. On your home network you should have an IP address assigned by your internet router (dsl/cablemodem/whatever). You need to bind your website to this address. You should then be able to use the machine name to get to the website, but I would recommend actually editing the hosts file of the client computer in question to point a specific name at that computer. The hosts file can be found at c:\windows\system32\drivers\etc\hosts (use notepad) and the entry would look like:

192.168.1.1     mycomputername
Stockstill answered 2/2, 2010 at 12:43 Comment(0)
M
0

Full worked solution on 2021.

The binding with IP is not worked. The asterisk solved the problem.

<bindings>
   <binding protocol="http" bindingInformation="*:63000:localhost" />
   <binding protocol="http" bindingInformation="*:63000:*" />
</bindings>

https://www.theancientscroll.com/tech/4-steps-aspnet-web-apps-lan/753/

Macaw answered 26/1, 2021 at 15:19 Comment(0)
C
-1

You have to do following steps.

Go to IIS ->
Sites->
Click on Your Web site ->
In Action Click on Edit Permissions ->
Security ->
Click on ADD ->
Advanced ->
Find Now ->
Add all the users in it ->
and grant all permissions to other users ->
click on Ok.

If you do above things properly you can access your web site by using your domain.
Suggestion - Do not add host name to your site it creates problem sometime. So please host your web site using your machines ip address.

Colpin answered 8/6, 2017 at 3:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.