瀏覽器訪問網站顯示:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
**核心原因:IIS 目錄瀏覽功能未啟用,且該目錄下不存在預設文檔 (Default Document)。** IIS 預設安全策略禁止列出目錄內容,必須有預設文檔才能直接訪問網站根目錄。
wwwroot, public_html, D:\Web\Site) 放入任一預設文檔檔名:index.html
index.htm
index.asp
index.aspx
index.php
default.html
default.htm
default.asp
default.aspx
default.php
檔名**大小寫不敏感** (Windows),但建議全小寫。上傳後重新整理瀏覽器即可正常顯示。
home.html)Options Indexes)index.html、default.aspx 等佔位檔若使用 MVC/單頁應用 (SPA) 無實體 index.html,可用 URL Rewrite 重寫至入口點:
「Directory Listing Denied」不是錯誤,是 **IIS 安全預設行為**。**上傳正確檔名的預設文檔** 即可秒解。生產環境**請勿啟用目錄瀏覽**,避免洩露敏感檔案結構、備份檔、配置檔等資訊。