如题,用127.0.0.1和ip可以正常访问tomcat、mysql,但是localhost却怎么也访问不了,网上说的办法我都试了,都解决不了问题,盼望高手指点~

解决方案 »

  1.   

    c:\windows\system32\drivers\etc\hosts用记事本打开,加入一行127.0.0.1       localhost
      

  2.   

    楼上几位,要是那么简单的话我早就解决啦。我都试过了,不行啊~我的C:\WINDOWS\system32\drivers\etc目录下有这几个文件,hosts,hosts.msn,lmhosts.sam,networks,protocol,services这几个文件,跟你们的一样吗?
      

  3.   

    # 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:
    #
    #      112.54.94.97     rhino.acme.com          # source server
    #       18.25.63.10     x.ss.com              # x client host127.0.0.1       localhost
    =========================================================================
    看看WINDOWS\system32\drivers\etc下的hosts中是不是有上面标红的那一行.
      

  4.   

    楼上方法都试了,还是不行啊~~没有高手了吗?期待高手出现~~~(我发现用opera浏览器时就能正确使用localhost,用ie等浏览器都不行)
      

  5.   

    呵呵,能用127.0.0.1就行了嘛,为什么一定要用localhost呢。。
      

  6.   

    记得sybase数据库里面貌似不可以用localhost得用127.0.0.1
      

  7.   

    把你的tomcat里的host文件里面重新设置你的localhost 为你的访问地址呀  你试试呀
      

  8.   

    在windows利文件里搜素hosts出来的 打开 
    写127.0.0.1 localhost
      

  9.   

    # 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