天天看點

【IIS問題】——預設網站localhost無法打開,錯誤類型404

前提

  小編最近在學習JQuery的一些内容,誰曾想上來的第一個Demo就把小編難住了,需要将本地html頁面上文本框中的内容上傳到伺服器上,然後将伺服器上的内容傳回。而小編将檔案放到IIS的預設網站上,本以為很簡單,可是發現小編沒有預設網站。而且在位址欄中輸入localhost,提示錯誤404,。也許是手欠吧,不知道何時把預設網站删除了,這個可怎麼辦?各種嘗試,最終找回了預設網站,解決了localhost無法登陸的問題。

解決方案

這個前提是建立在安裝好iis的基礎上的,在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      

注意下預設網站的端口為圖中的樣子,對于這個localhost規定就是這樣的沒有什麼理由可言,按規矩做就可以了。然後重新開機計算機完美解決。

【IIS問題】——預設網站localhost無法打開,錯誤類型404

  

總結

繼續閱讀