Localhost not found (404) iis - asp.net

I am having several issues with the DNS localhost on my computer.
Some instruction is redirecting all my explorers, including visual studio somewhere else than 127.0.0.1 when I visual studio or any browser looks for localhost.
Where can such thing be happening? I recently changed my hosts file to point localhost somewhere else, but then it did not work so I switched it back, so that cant be the problem.
# Copyright (c) 1993-2009 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
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
I have also unistalled and installed IIS, so is not a problem of iis not redirecting properly..
I am not being able to run Visual Studio solutions because of this problem.
I have tried pining 127.0.0.1 and it responds, I have also tried localhost and it also works, but when I type localhost on a browser it redirects to a "404" page.

Make sure that IIS is actually configured to listen on 127.0.0.1 (perhaps you removed the binding previously?)
netsh http show iplisten
IP addresses present in the IP listen list:
127.0.0.1
You can add additional IPs like so:
netsh http add iplisten ipaddress=10.0.0.10

I just had this problem too and it turned out to be an issue with Default Web Site's bindings in IIS. I had specified the "Host Name" to be the server's domain name, meaning external access worked fine but trying to access any IIS page through localhost returned a browser 404 error.
Simply clearing that "Host Name" field and leaving it blank fixed the problem for me.

I added a binding to the site that accepted IP address 127.0.0.1 over port 80 and was able to connect.

Related

forward localhost to ipadress on local netwerk

I have a domain name registered and i made an A record on it that points to 127.0.0.1 (aka localhost). I want to be able to work on websites in this case from machines that are in the same network as the server its running on but those servers are not open to the public internet. I still want to use my test subdomain to access this website but that would point to the machine im working on at that time so it must forward the requests to an 192.168.. ip adress I have set entered on the machine. Is there a windows command i could use that forwards localhost to a specific ipadress, like linux has 'iptables'? Or a program that could do this? Preferably for free.
I dont want to add my internal ipadress to a dns record because that would be sensitive information.
What about adding an entry to /etc/hosts (linux) or c:\Windows\System32\Drivers\etc\hosts (windows) ?
The format is: <ip address> <servernname>, e.g.: 192.168.10.12 www.stackoverflow.com.
Once you did that, accessing http://www.stackoverflow.com from the machine where the hosts file has been edited will end up being served by the server running on 192.168.10.12.

IIS 10 Site Bindings wildcard development machine

I have successfully setup IIS on my local development machine (dev branch - setup as localdev.me) but when I went to setup another branch (hotfix - setup as localhotfix.me) I am running into issues. The issues are due to the way the site is setup. The subdomain of the url is used to determine which Database to connect to. So going to host.localdev.me will connect to the host database. So in IIS I have the following settings for the bindings of the site.
Type Host Name Port IP Address
http localdev.me 80 *
http *.localdev.me 80 *
I can ping localdev.me with any subdomain and I get the loopback address as expected. When I then setup the hotfix branch (exactly the same as the dev but with the following bindings) I get name not resolved errors.
Type Host Name Port IP Address
http localhotfix.me 80 *
http *.localhotfix.me 80 *
Is there a reason the first setup would work and not the second? What is perhaps even stranger if I tell IIS to stop I can still ping subdomains on localdev.me and get the loopback address.
I could always get it working by manually specifying the host name in my windows hosts file but I would rather not do that as I would need to go in and edit the file every time we add a new subdomain.
EDIT: These are the specific errors I am getting.
ping localhotfix.me
Ping request could not find host localhotfix.me. Please check the name and try again.
EDIT2: I have a solution that works fairly well. It requires Acrylic DNS and installation of the Microsoft Loopback Adapter. I set the loopback adapter to a valid IP Address and set the DNS server to 127.0.0.1 then edit the AcrylicHosts file to contain entries for each domain with a wildcard. Once I did all of this I was able to ping localhotfix.me along with *.localhotfix.me. I believe the reason localdev.me worked is because it is a valid domain. The name would resolve at which point I believe IIS was able to take over. But thats really just an educated guess. But kindof makes sense as to why it worked for one and not the other.
The reason *.localdev.me works without a hosts file is because the public DNS for that domain resolves to 127.0.0.1 as long as it is not localdev.me or www.localdev.me. You can check this using nslookup *.localdev.me (replace the asterisk with anything except www) while your hosts file is empty. On the other hand, *.localhotfix.me is not registered in public DNS at all, which is why you'd need a hosts file entry for those.

how to configure IIS for a specific website nam

Hi everyone,
I have configured my web application using IIS7. It is running fine for http:// localhost/, but I need to give some website name like http://myexamsystem.com/
instead of "localhost".
I have tried all the possible ways from IIS7, but I am not getting the result.
Steps I did upto now:
Step 1: Right Click on "Sites".
Step 2: Selected "Add Website" option.
Step3:In "Add web site" dialog box:
Site Name:"myexamsystem", Application Pool: "DefaultAppPool"
Physical path: "desktop\myproject folder"
Binding
Type:HTTP, Ip address "All Unassigned", Port:80
Host Name: "myexamsystem.com"
OK
Error Messege:
This page can't be displayed
•Make sure the web address http://myexamsystem.com/ is correct.`
If this is just for debugging / local development, then you'll need to add an entry in your HOSTS files. This is located:
c:\windows\system32\drivers\etc\hosts
It can be edited in notepad (if you have administrator rights on your machine). You just add the following entry:
127.0.0.1 myexamsystem.com
Note that this will only work locally. If you want it public, then you'll need to buy the domain name and point it to an external IP address.
Update
Just seen your comment about it needing to run on your local network. A quick way is to add your internal network IP address to each machine's HOSTS files. You can find out your internal IP address by typing ipconfig into the command prompt. Then add it to the HOST file of the other machines in the same way as I descibed above, except use your internal IP in their HOST file rather than 127.0.0.1.
If you don't want to manually add them to each computer, then as far as I know, you'll need a DNS server.

creating url to use instead of ip address for aolserver used in project open

In Project-Open tool, aolserver is used to host the application and is accessed using the ip address of the server like 172.XX.XX.XX:8000.
Now I don't want to make this ip address public. I tried to create and use url (by making some changes in the config.tcl ) for this but couldn't do so.
Please let me know if my question is not clear enough.
thanks in advance!!!
Well, your question isn't totally clear, but I think what you want is for your website to appear on a URL, such as www.example.com. To do this with AOLserver, you need to edit the /web/server/etc/config.tcl file and edit this line (changing www.example.com to whatever URL you want).
set hostname www.example.com
Then restart AOLserver. You might also want to set the port to 80. This requires root access, and you may also need to pass -b to AOLserver in your startup script.
I understand you are running ]project-open[ on a local server on port 8000 and you want to make this service visible to the Internet, right? There are several steps required:
In your Internet router, you will need to open a port (80 or 8000).
You need to forward incoming traffic on your router to the ]project-open[ server. You can do this using a forwarding rule or similar. Please check your router.
You probably want to setup a URL using DynDns, Dynu or other DNS providers pointing to your Internet router, and changing in case your router's IP is also changing (SOHO router).
In ]po[ you will need to set the redirection URL accordingly. Depending on the port, you may want to set Admin -> Parameters -> "SuppressHTTPPort" to 1
Which OS will you be using to access this server? If you will be using a LInux machine you would put the host name into your /etc/host file with the desired name:
For example:
/etc/hosts:
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.23.108 myprojecturl
The line 192.168.23.108 will provide for you to use myprojecturl to access the site rather than the ip number 192.168.23.108 (from that machine).
From a Windows machine you could do the same. The host file is located in a different plaice ().
c:\windows\system32\drivers\etc\hosts:
# Copyright (c) 1993-2009 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
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.23.108 myprojecturl
The last line is an example of what you would add to make "myprojecturl" the host name for pulling up the site instead of having to remember the ip numbers to type in.
If you're trying to make generated urls be different from the where the server is listening, you need to set the location parameter in the nssock configuration.
in the config fie is a section like this:
ns_section ns/server/${server}/module/nssock
ns_param timeout 120
ns_param address $address
ns_param hostname $hostname
ns_param port $httpport
Add in
ns_param location http://my.host.com/
see http://blog.gmane.org/gmane.comp.web.aolserver/month=20110201

localhost problem on windows 7

I'm using Windows 7 Pro and want to run my web project locally, but the url www.localhost.com does not work.
If use http://127.0.0.1:2710/default.aspx it works. I checked host file which in the C:\Windows\System32\Drivers\Etc\hosts folder. If I delete the rows:
# 127.0.0.1 localhost
# ::1 localhost
Nothing changes. How can I make www.localhost.com work on my machine?
Hope I understand your question correct. You want to acces your local site using www.localhost.com
Just edit the hosts file and add the following lines
127.0.0.1 www.localhost.com
I checked my Windows 7 hosts file and it has the following lines
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
Above lines are comments and deleting those lines does not do anything.
Note: If you get "Access denied" when you save the hosts file then open notepad as Administrator and then edit hosts file and save it. It should work
EDIT: The rows you deleted were just comments, so that doesn't matter.
Were you trying to enter your url just as localhost
or as http://localhost:2710/default.aspx?
The latter is probably necessary, as the 2710 is the port number, and without it will default to port 80, which probably doesn't have anything listening on it.
UPDATE: It might actually be an IPv6 thing, so try it with just this line in your hosts file:
127.0.0.1 localhost
You should not have a # at the beginning of the line, that will disable that line.
(You might need to reboot too).
You could also try pinging localhost (just type ping localhost in a command prompt window) and check that you get a reply from 127.0.0.1
Did you try:
http://localhost:2710/default.aspx ?
Okay, simply put, your web project will run on http://localhost:2710/default.aspx, once you put those lines you removed back into the hosts file (More on it here). To get to remove the port number, you need to reconfigure your web server.
Now, if you want to get a domain, that's a different thing altogether... then, you need to get a registrar and use DNS to get it to map to you. You would do this if you wanted other people to be able to use something like www.site.com to get to your site.

Resources