1. 程式人生 > >localhost無法訪問本機

localhost無法訪問本機

1、開啟Internert資訊管理檢視IIS是否啟動,且預設網站時候已經開啟; 
2、開啟http://127.0.0.1 看是否能訪問IIS的預設網頁,能訪問則說明IIS已經成功安裝到電腦上,可能是無法解析localhost; 
3、開始--命令(cmd)--ping localhost,看是否能ping通,從127.0.0.1上返回資訊,如果成功則說明可以解析localhost; 
4、如果上一步不成功,則用記事本開啟C:/WINDOWS/system32/drivers/etc/hosts檔案,看裡面是否有包含:127.0.0.1 localhost ,如果沒有則將其新增進去,再檢視能否訪問localhost。 
5、嘗試將網站的主目錄指向另一個目錄或新建一個虛擬目錄,並在該新目錄建立一個新的網頁檔案,如index.html,然後將其加到預設網站的"文件"項中作為預設訪問的網頁,重新輸入網址:http://localhost,看否能訪問。 
6、還是不行的話將IIS解除安裝掉,重新再安裝一次。 

還有一種情況也會導致"無法訪問localhost, 但可以訪問127.0.0.1",這是我所遇到的,返回的資訊如下: 


The page cannot be displayed 
There is a problem with the page you are trying to reach and it cannot be displayed. 


-------------------------------------------------------------------------------- 

Please try the following: 


Click the Refresh button, or try again later. 

Open the Web site home page, and then look for links to the information you want. 
If you believe you should be able to view this directory or page, please contact the Web site administrator by using the e-mail address or phone number listed on the Web site home page. 
10061 - Connection refused 
Internet Security and Acceleration Server 

-------------------------------------------------------------------------------- 
Technical Information (for support personnel) 

Background: 
The server you are attempting to access has refused the connection with the gateway. This usually results from trying to connect to a service that is inactive on the server. 

ISA Server: XWProxy1.star-net.cn 
Via: 

Time: 2008-10-14 0:50:36 GMT 


這是因為我所在部門的電腦只能通過區域網內主機做代理伺服器來訪問網路,在設定代理伺服器的時候,未將"對於本地址不使用代理伺服器(B)"打鉤,導致訪問本地地址的時候也實驗代理伺服器,localhost只能被本地主機解析,代理伺服器不能解析其他主機的localhost。只要將 Internet選項--連結--區域網設定--代理伺服器 下的那個√打上就可以了。