Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browse Web Site With IP Address Rather than localhost

I am using VS2012 with IIS Express and can not seem to browse my web sites using my IP Address. Is there some way to do that? It used to work fine with earlier versions of VS.

For example, this address works fine:

http://localhost:64651/

But, this address does not work.

http://192.168.252.165:64651/

I am sure of the IP Address, since I just got it using ipconfig.

like image 958
ADH Avatar asked Feb 14 '13 18:02

ADH


People also ask

How can I use IP address instead of localhost?

To access the server from itself, use http://localhost/ or http://127.0.0.1/ . To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address.

How do I access a website using IP address?

Type the string “http://” followed by the IP address and then a forward slash. For example, type “http:// 209.191. 122.70/” (without the quotes).

Can you use IP address as a website?

Shared Servers– The most common reason that websites cannot be addressed through an IP address is because they are websites served from a shared server account where the domain is one of many under a single IP address.

Can I access localhost but not IP?

0.1 (or localhost ) but not via the computer's ip address, this means that the server software is configured to listen on the localhost interface only. This is a configuration item and to avoid exposing a potentially unsecure server many server programs come preconfigured to listen on localhost only.


1 Answers

Go to your IISExpress>Config folder, locate applicationhost.config. Change <bindings> as below:

<bindings>
      <binding protocol="http" bindingInformation="*:1407:YOUR_IP_ADDRESS" />
</bindings>

Before you do this , you will have to register this IP address using netsh command as below:

Port forwarding in Windows 7

If you’re running Windows 7, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 192.168.1.11:1234 with whatever IP and port you are using:

> netsh http add urlacl url=http://192.168.1.11:1234/ user=everyone

This just tells http.sys that it’s ok to talk to this url.

IMPORTANT: The user=everyone parameter must be specified according to the system language. So if your windows language is spanish the parameter must be user=todos.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=1234 profile=private remoteip=localsubnet action=allow

This adds a rule in the Windows Firewall, allowing incoming connections to port 58938 for computers on your local subnet.More information at this link.

Port forwarding Mac OS X

Step 1: View Current Firewall Rules

sudo ipfw show

Step 2: Add Port Forwarding Rule (80 to 8080)

The default port that Tomcat runs on is 8080, so here we show the command to do port fowarding from port 80 to 8080 (Tomcat’s default port). Obviously, this works for other ports as well, and you’d just have to adjust the command accordingly.

sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in

This is a temporary change, and it will revert once you reboot. If you want to make it permanent, you can create a lauch deamon for it.

Optional Remove Rule

If you want to remove your firewall rules run:

sudo ipfw flush

Port Forwarding Using PFCTL (aka PF) on Mac OS X

The setup for pfctl is similar to ipfw. Github user kujon has created a nice guide to show how to set up port forwarding from port 80 to another port using pfctl.

Note: Be sure to change the bindings of your project only by locating its name. You can even keep the localhost binding and add a new one , this way you can access same webpage using both the given IP address and your old localhost binding.

like image 174
Bhushan Firake Avatar answered Nov 10 '22 00:11

Bhushan Firake