Share via


Localhost does not work, 127.0.0.1 does...

Question

Tuesday, February 21, 2006 11:35 PM

Hi,

I'm trying to test my apps using Web Developer Express Edition but for some reason when I click "start debug", Internet Explorer pops up and it's just a white screen with IE *trying* to connect.  Yet if I substitute http://localhost/mywebsite1/default.aspx with http://127.0.0.1/mywebsite1/default.aspx it will work.

Not a big deal, but I have to keep renaming it everytime I test my app.  Further more, when I try to configure ASP.NET via "Website" menu item, I get the same blank screen.

And last, I noticed, my server port usually does not change.

Thanks!

Leo

All replies (9)

Wednesday, February 22, 2006 6:57 AM

127.0.0.1 is nothing but localhost. It's strange as to why it fails when you type localhost and does not when you type 127.0.0.1.

Anyway did you make any changes in the host header file??

Look in C:\WINDOWS\system32\drivers\etc for the hosts file (no extension) and see if you have 127.0.0.1 mapped to localhost.

For example your default host header file will look like this.

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

HTH,

Hotfixer.


Wednesday, February 22, 2006 7:27 AM

I checked the file and it's exactly like the one you posted.  Before when I had apache manually installed (for PHP dev), I noticed Web Developer Express would work just fine, but that I had to use the 127.0.0.1 method when I tested my PHP files using Apache. 

But now, I notice Web Developer will not work correctly. 

I'm running Windows XP Home SP2, Apache, MySQL, PHP, and Windows Web Developer 2005.  Obviously I stop the Apache/MySQL service before using Web Developer.

Thanks,

Leo


Friday, February 24, 2006 1:27 PM

You say you have XP Home, but XP home does not have IIS, so you are using Apache on the local machine? If you stop the Apache server then I would expect http://localhost not to work.  If you open a web site from a file system location and try to run it then VWD will launch the ASP.NET Development web server.  That server opens a port on your machine and listens for local requests, so the URL of your web would have a port number in the URL such as http://localhost:2205/mywebsite1/default.aspx

Try Ctrl+F5 (run without debugging) in VWD and see if the page runs.  Perhaps you have Windows Firewall turned on and it is blocking the port that VWD is trying to use for your web site?  You can change the Properties of your web site to use a fixed port number, and add that port as an exception in Windows Firewall so it won't be blocked.


Saturday, February 25, 2006 1:54 AM

It is because of your apache server.
Either from the services set the start of apache as manual.
or
Change th port number from 80 to some othe e.g 88 in the configuration file of the apache it is placed in
C:\Program Files\Apache Group\Apache\conf\httpd.conf
then enjoy [:)]


Saturday, February 25, 2006 3:53 PM

Hello,

Thanks to all for the support. What I don't understand is that when I turn on the Apache server (it's installed as a 'service' and I had it on 'manual') and I type:

http://127.0.0.1/phpinfo.php - This works

http://localhost/phpinfo.php - This doesn't work

Currently, Visual Web Developer w/ .NET framework is not installed.  So Apache is the only server I have running. 

Also I don't use IIS (since I have WinXP Home) instead I was using VWD's nice integrated server (which I loved and worked fine, until one day I started getting the "not found error"). 

Thanks,

Leo


Saturday, February 25, 2006 4:05 PM

Little update:

I changed the port from 80 to 88 (in Apache) and the pages would not even load.  So I had to switch back to port 80.

I also noticed that when I type http://localhost (in both cases, port 80 & 88), I don't get a quick "Page not found" error.  Instead it starts to load... and load... and load for a LONG time, then nothing happens.

So I suspect I have a problem on my end and it's not a problem with apache or vwd 2005.  But I have no clue on how to setup my localhost.

I did many searches on yahoo and google, and no results.

Thanks again!

Leo


Monday, February 27, 2006 1:17 PM

Have you tried turning off Windows Firewall temporarily as a test?  Or any other firewall program such as ZoneAlarm?  I have seen firewall configurations interfere with network requests and responses.  Otherwise, there must be an Apache forum somewhere you can post to.


Monday, February 27, 2006 9:29 PM

Yeah I turned off my firewall (both Norton Security and Windows).  Well this really isn't an Apache question.  It's more VWD.  I can run Apache fine, becuase even though localhost doesn't work, 127.0.0.1 does... so I can run my apps using 127.0.0.1.

But VWD uses "localhost", so I can't test my apps.  I'd have to change the html address everytime I hit "run".  Also options like "configure ASP.NET" are not useable because of the localhost problem.

Is there no way to install or restore "localhost" on WinXP Home?

- Leo


Tuesday, February 28, 2006 1:02 AM

Try right-click on the web site node in the Solution Explorer, pick Property Pages, then Start Options and set Start URL to custom.