localhost lookup fails, browser tries www.localhost.com instead - asp.net

I used to run web applications all the time on my laptop, no problems, I am using VWD 2008 Express, i have the latest framework, Windows Vista Home Basic...etc..
Now, when ever i try to run a website, or even chose to Show a Page in Browser from Within VWD, the browser (both IE and Firefox) keeps looking for www.localhost.com...
I tried to copy the address of and paste it directly in the title bar, nothing, same problem i tried to get that address from the balloon notification (the one that pops up when you run any ASP.net project), still nothing happens...
My colleague is facing the same problem, but for him, he can simply copy and paste the url in the address bar, but its not working with me....Heeeeeellllllllllllllllp

Check your hosts file, it should be redirecting localhost to 127.0.0.1 and nothing else. The entry that will cause this error should look like this:
127.0.0.1 www.localhost.com
If you find this, remove it or change www.localhost.com to localhost.
You can also try to post one of these in the adress bar:
127.0.0.1
http://localhost
Note that the hosts file is a popular victim of viruses, so if is has been modified, you might run a check on viruses.
Also see the discussion here.

If that also doesn't work, open up nod32 (you probably have it installed on your system if the above methods don't work) go to advanced setup, on the left menu, select protocol filtering, and select HTTP and POP3 ports... ;)

I got the same problem in firefox 3.6 when my server was down.
In my case it was not a problem with etc/hosts where the line
127.0.0.1 localhost
was there and OK.
The solution that worked for me was to disable the "cleaver" URL fixing that Firefox carry out when the page is not found. The procedure taken from here:
Type about:config in the address bar and hit return.
find browser.fixup.alternate.enabled
double click the “true” value. The line will become bold, and the
value will change to “false”
This fix directly the problem. No firefox restart needed. If your server is down you get "page not found" as expected.
Hope it helps.

Thank you for your solution ... this works fine...
I got the same problem in firefox 3.6
when my server was down. In my case it
was not a problem with etc/hosts where
the line
127.0.0.1 localhost
was there and OK.
The solution that worked for me was to
disable the "cleaver" URL fixing that
Firefox carry out when the page is not
found. The procedure taken from here:
1. Type about:config in the address bar and hit return.
2. find browser.fixup.alternate.enabled
3. double click the “true” value. The line will become bold, and
the value will change to “false”
This fix directly the problem. No
firefox restart needed. If your server
is down you get "page not found" as
expected. Hope it helps. link|flag
answered Sep 3 at 7:55 joaquin
2,237112

A couple of random things to check...
localhost is the conventional name for the IP address 127.0.0.1. If that address doesn't work, then you have a network configuration problem.
There will be a hosts file somewhere, probably in somewhere like C:\Windows\System32\Drivers\Etc\hosts which should usually contain only that definition for localhost. If it has more names in it and you didn't put them there, then you have another problem entirely.

There is also the forehead-slapping possibility that your web server is not currently running. :)

Related

Codekit 3 - External Server Issue

I've been using codekit for ages now, and now I've been using the version 3 since it came out.
I really like this app, but there's something I never really understood and I decided to post it here (hoping to finally understand how this works and how to make it works like I want).
I have MAMP pro installed, with some hosts.
Let's say I have this list of hosts with (fake) document root:
localhost -> documents/site1/dist
test -> documents/sitetest/dist
and let's assume that test is a wordpress site having the site url set to
http://test/ in the database.
In codekit, when I enable the browser refresh, the bottom options asks me to write down the address I would visit to see my website.
Now, if I navigate to http://test/ my WordPress website loads and I am able to see everything.
In codekit I then setup the browser refreshing options to be the following:
Animation: ticked
Refresh Delay: 0.0 seconds (default)
Preview: empty
Document-Root Subpath: empty
External Server Required: on
External Server Address: http://test/
Then when I click on the green dot (server) to preview my website, I'm expecting codekit to navigate to http://test:5757 and to properly display my website. This, unfortunately, is not the case. When I click on the preview (or server, it doesn't really make any difference for me) codekit navigates to my mac IP and the website is either not loading or loading without any external resource.
I don't think the issue is in the way I load the resource in WordPress (i use enqueue sources properly, and the website without using codekit refresh function works, load and displays as meant to).
So far, I always switched my current project to use the localhost host (changing the document root in MAMP pro) and then telling codekit to use the localhost ip as external server, but now it's a bit more complex, as I have way more projects and I was hoping not to change back and forth the document root to use codekit built in refreshing feature.
Is it possible? am I missing something here?
I read all I was able to find as well as watched the videos on codekit, but this bit here is still a bit unknown to me and any help would be really appreciated.
Thanks
PS: No need to mention I am on a MAC, right? :)
I don't believe I actually managed to fix this.
I'll leave the answer here in case somebody else is facing the same issue.
The problem I had was that my website http://test/ was using a theme called test.
Codekit, for refreshing the browser, uses a simple string search and replace in the URL, and so everything that looked like "test" in the url was replaced by the internal ip.
Quick example:
http://test/wp-content/themes/test/index.php
became
http://192.168.0.1:5757/wp-content/themes/192.168.0.1:5757/index.php
and of course no file where loaded successfully, as the path was wrong.
To fix this?
Just change the MAMP pro address to something that won't be present in the URL (in my case, the MAMP pro host called test became dev.test and problem solved.

Lighttable Internal Browser and localhost proxy

Ok so this may be a dumb question or possibly something that just isn't supported but haven't had much luck finding an answer.
I'm testing out Light Table for use as my day to front end editor and have been trying to get a page loading in the internal browser without success. I have a weblogic server running my app which I can access from Chrome and other browsers but when I try to point Light Table's browser at the same url I get the generic proxy can't connect to destination.
My first thought was that this I needed to configure Light Table to work with the company proxy but I am able to get to other sites from light table using the built in browser and I have the env variables http/https_proxy set. Has anyone seen this issue or know of a fix/workaround?
Ubuntu 14.04
Light Table 0.7.0
Chrome 36.0.1985.125
It's weird but sounds "reasonable" that you don't really need any proxy to access localhost. I'd check using 127.0.0.1 in your url rather than localhost if you already didn't.
I recall a weird issue probably unrelated on Ubuntu that prevented the right name resolution. The resume is to check that /etc/hosts should contain just 127.0.0.1 localhost rather than your_machine_name 127.0.0.1
lein repl error:Connection refused

Developing ASP.NET Facebook App Locally

I've searched around and found a lot of advice saying to modify the hosts file as such:
127.0.0.1 mydomainname.com
I've done that, but my actual site at mydomainname.com is still being used. Any other troubleshooting steps I could take? Any other suggestions?
Restart your browser, try ipconfig /flushdns (I'm a bit hazy on Windows DNS caching so that may or may not help here) or restart your computer. Unless you've done something really weird, the hosts file should have priority, so something must be caching the DNS result.
simply setup your canvas address as localhost. Unless you're using FBML, it works. See http://fbgraph.computerbeacon.net/tutorial/section1/createnewapp.aspx for an example.
Just make your redirect_uri your localhost address like:
https://graph.facebook.com/oauth/authorize?client_id={consumerKey}&redirect_uri=http://localhost:4403/Handshake
I have mine set up in visual studio to switch between localhost and live return_url's depending on whether debug or release is selected

Wordpress + VMware CSS path problem

I posted a similar question earlier today but this question is clearer.
I want to locally develop my Wordpress websites (on my Mac) and test them in Internet Explorer (6,7,8) on Windows XP.
I can get the MAMP welcome screen to show in Windows XP, so I know VMWare is doing it's thing.
The local URL for my site (on my Mac) is:
URL (http://d3creative:8888/)
But the local URL under VMware/Internet Explorer is:
URL (http://192.168.2.1:8888/d3creative/)
This is the only way I can get it to show up, problem is all the CSS styles are referencing the local Mac URL (http://d3creative:8888/)
So understandably the CSS isn't showing up.
Is there a way to tell Windows that "http://192.168.2.1:8888/d3creative/" should equal "http://d3creative:8888/"
I've tried editing the "hosts" file within in Windows XP and I've rebooted after making any changes, but nothing is working.
My software:
MAMP Pro (v1.8.2)
Wordpress (v2.8.6)
Windows XP (SP3)
Internet Explorer (6, 7, 8)
Any help would be much appreciated.
Stephen Meehan
Thanks for everyone for taking a look at this, after much head scratching I have arrived at a solution!
Here's how I did it. hope this helps anyone else with the same problem. I'll be posting a video walk though for this at the end of next week on my website.
MAC OS
Open terminal to find your Mac IP address
type: ifconfig in terminal
Scroll down until you see "vmnet1"
Look for the word "inet" next to this is the IP address you need
Make a note of this as you will need it when you modify the "hosts" file in Windows XP
Close Terminal
VMWare:
Set network adapter to "host-only" and make sure it is connected.
Add your MAC Address in the Advanced options field
(Your Mac address can be found in the system preferences under network)
Close the window and it will ask you to apply changes, say yes.
Windows XP
Open the hosts file (c:\windows\system32\drivers\etc\hosts)
Use notepad
You should see:
127.0.0.1 localhost
Under this enter the Mac IP address you got from Terminal followed by the name of your local site - in this case the site name is "newdemo". The site is determined by the Server name you set in MAMP Pro
Your Mac IP Address newdemo
Your hosts file should now look like this:
127.0.0.1 localhost
Your Mac IP Address newdemo #change this to the Server name you set in MAMP
Command prompt (Windows)
Open command prompt (start button > run > type in CMD)
Type ipconfig/flushdns
Now when you visit http://newdemo:8888/ you will see your local site in Internet Explorer!
Good luck!
Stephen Meehan
From your description, you have the site hosted on a Mac which is also running a virtual machine with Windows on it and when you try to access your site on the Mac from Internet Explorer in the VM you get no css but do you get the css fine if you point Safari on the Mac back at itself?
I would view the source of the Wordpress page in IE and check that the url for the css file is relative to the root of the website and not pointing directly at a filename in the OSX directory tree.
But without knowing what is actually in the rendered source code in the browser, it seems hard to think of what the problem might be.
The hosts file is certainly the first way to go (and should work for translating the host name into the IP no problem) but the problem in your case is that you need to serve different directory levels. Why is that in the first place? It can certainly be solved with mod_rewrite but it's awfully cumbersome.
Can't you address the whole site with http://d3creative? Won't that solve the hierarchy problem?
Im not much of a techie, but cant you just use wamp on the xp side?
http://www.wampserver.com/
You're going the wrong way with the hosts file -- instead of trying to get your browser to treat 192.168.2.1 as d3creative, putting the entry in your hosts file will allow the machine to resolve d3creative -- visit http://d3creative in your Windows browser.
HTTP works by first resolving the host name to an IP address, if required, then by passing the host name (or IP address, if no host name was given) when it connects to that IP address. The hosts file looks after extra mappings between names and IP addresses, it doesn't have anything to do with what the browser will pass to the server once the connection has been made, while the server will decide which locally-hosted site to return based on what the browser tells it after the connection has been made.

Not able to run ASP.NET web app using Development Server

My development machine (Vista) was working perfectly fine for over a year and then suddenly (without explicitly installing anything) I am unable to run the websites using ASP.NET development server.
The development web server starts fine, but IE cannot display the page:
Internet Explorer cannot display the
webpage
Firefox says - Failed to
Connect, The connection was refused
when attempting to contact
localhost:49447.
Here is what I have tried so far:
Disabling firewall
Stopping anti-virus
Stopping Windows Defender
It worked when I stopped all services using MSConfig and tried again.
However, that disables most of the services, so is not a feasible long term solution.
After stopping all services, I tried starting services one by one to find out which one is causing problem.
These are the steps and results:
I found DNS Client Service was
causing problem.
So I started all others and
stopped DNS Client service, but then
Network Location Awareness service
started causing problem
I stopped DNS Client Service and
Network Location Awareness and
started all others, btu again
something else is causing problem.
Clearly there is something common and fundamental at the root of this.
I do not know much about networking. Can someone guide me in right direction?
Note: I have found another person who
is having same problems since this
morning. Looks like it could be
related to one fo the windows updates!
Is anyone else getting affected like
me?
I was able to fix this on my computer by doing the following:
My host file contained this line for the localhost entry, which is how the host file ships with Vista, and i've never modified this line
::1 localhost
Replaced "::1 localhost" with the this:
127.0.0.1 localhost
"::1 localhost" has worked fine for me for well over a year, until this morning. Windows defender installed two updates, one yesterday and one this morning, my guess is that something in one of these updates caused this entry to not work anymore.
I have solved this problem.
The problem comes because somehow the entry in host file is removed for localhost.
you have to add entry in host file which is kept in System32/etc folder.
just add this at the end of the file.
127.0.0.1 localhost.
save this file and try to ping localhost from cmd prompt.
i think this will resolve your problem.
now try running you website.
All the best.............
If stopping all the services made it owrk, try stopping one at a time. Eventually you will find out which one it is.
Hopefully someone will know which it is from experience, but if not you can find it yourself.
Sounds like you have a proxy server issue - have you checked this out?
KB886388 - You may receive a "Failure to connect to Web server" error message when you browse local Web applications
I also started to get this problem tonight, think I installed a windows update package yesterday.
I'm running VS 2008 (9.0.30729.1 SP) and Vista Ultimate SP1 (32-bit).
Replacing localhost with 127.0.0.1 worked for me.
http://localhost:49227/testsite/Default.aspx
http://127.0.0.1:49227/testsite/Default.aspx
I'm having the same problem. Was working on my website last night, one minute the site worked in the broswers next minute it could not connect to the localhost.
Replacing localhost to 127.0.0.1 worked for me. I'm still inexperienced in asp.net, is there a file where you change
http://localhost:49227/testsite/Default.aspx to
http://127.0.0.1:49227/testsite/Default.aspx
As I am just changing the url in the browsers
This one also worked for me. What I did was:
Go to the Property Page of my Project.
Then under Start Options, look for the Server, instead of 'Use default Web Server', i changed it to 'Use Custom Server'.
Typed the http://127.0.0.1:49227/MyProject/ in the Base Url.
That's it. It automatically opens the site using this link.
Same problem here using visual studio 2008 express
Changed "localhost" to "127.0.0.1" and the page came up.
This problem seems to have an effect on internet explorer and firefox
Opera hasn't seen this problem :-)
Grtz
Changing "localhost" to "127.0.0.1" worked well for me, as well.
but just to clarify the whom are not familiar with vista here are the guidelines to change:
Browse to Start -> All Programs -> Accessories
Right click "Notepad" and select "Run as administrator"
Click "Continue" on the UAC prompt
Click File -> Open
Browse to "C:\Windows\System32\Drivers\etc"
Change the file filter drop down box from "Text Documents (.txt)" to "All Files (.*)"
Select "hosts" and click "Open"
Make the needed changes and close Notepad. Save when prompted.
The problem comes because somehow the entry in host file is removed for localhost.
you have to add entry in host file which is kept in System32/etc folder.
just add this at the end of the file.
127.0.0.1 localhost.
save this file and try to ping localhost from cmd prompt.

Resources