Mike Cheel
Mike Cheel

Reputation: 13106

CANNOT access via http://localhost but CAN access via http://computername or DNS from the internet

So...

'http://server_ip_address/application' works locally

'http://dns_address/application' works locally

'http://computer_name/application' works locally

'http://localhost/application' does not work locally

Any ideas on getting localhost to work again? It does work for the browsing the root however.

This is IIS 7.5 and ASP.NET MVC 2 running in classic mode.

Upvotes: 2

Views: 21912

Answers (4)

magallanes
magallanes

Reputation: 6854

open this file c:\windows\system32\drivers\etc\hosts with the notepad and add the lines

127.0.0.1       localhost

if it is commented (default, line start with ;) then uncomment it.

and try it again.

bad: (ipv6 problem)

C:\Users\Administrator.DEVJC>ping localhost

Pinging DEVJC.vaio.cl [::1] with 32 bytes of data:
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C

good: (ipv6 and ipv4 compatible)

C:\Users\Administrator.DEVJC>ping localhost

Pinging DEVJC.vaio.cl [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C

Microsoft says "# localhost name resolution is handled within DNS itself." but it is a lie (an half-lie). Sometimes is true but in a few cases it fail (or it try to resolve externally = slow)

Upvotes: 4

Sheshadrinath R
Sheshadrinath R

Reputation: 99

You can also resolve by adding the Binding information in your IIS. To do this:

  1. Open IIS
  2. Select Default Web site
  3. On right side actions panel, select Bindings. You will get site bindings screen
  4. Add a new binding adding 'localhost' in the Host name field
  5. IP Addresses field can contain text 'All Unassigned'
  6. Then save and reset IIS

After this I think you should be able to browse all applications hosted in your IIS with localhost.

Upvotes: 2

MSH
MSH

Reputation: 193

I found my problem , In my server I Have Microsoft Thread Management Gateway (Microsoft TMG) in the firewall policy there are "HTTP Protocol Policy" Right click it --> "Configure HTTP" --> "General" --> "URL Blocking" --> uncheck block high bit characters --> click OK then Apply

wait to TMG sync firewall. then go to your site and check your problem.

Upvotes: 1

Mike Cheel
Mike Cheel

Reputation: 13106

This is happening because I am only allowing SSL for the application which is enforced by a redirect mechanism to the SSL page AND the SSL only listens on the correct port.

Thanks for the help guys, I really appreciate it.

Upvotes: 4

Related Questions