IIS 開啟執行 ASP 的應用程序設定
當 IIS (Internet Information Services) 顯示 500 伺服器錯誤時,包含錯誤的程式碼、資料庫連接和網站設定,表示發生未知的錯誤,導致該網站無法正確處理請求。使用 Windows 應用程序在 IIS 預設中很多項目需要以手動開啟這些設定。
必須先於控制台 程式集 程式和功能 開啟或關閉 Windows 功能來 啟用 IIS 功能。
於站台 Default Web Site 的 ASP 項目中選擇「開啟功能」
將錯誤傳送到瀏覽器
通用的錯誤頁面 500 內部伺服器錯誤,想要知道錯誤的原因和解決方法,打開 ASP「傳送錯誤到瀏覽器」屬性設定。只建議在開發或測試環境中使用,因為它可能會暴露程式碼或資料庫連接字串等敏感資訊。
顯示 500 內部伺服器錯誤的偵錯訊息
如果應用在本機電腦環境設計製作時的檢測比較好抓出程式的錯誤問題,如果使用於網站伺服器則建議關閉,必免讓入侵者有訊息可以辨識。在正式環境中,應該將「傳送錯誤到瀏覽器」屬性的值設定為 False,並使用自訂的錯誤頁面或日誌檔案來處理錯誤。
啟用上層路徑
在 IIS 中預設上層路徑的連結是允許的。啟用上層路徑會指定是否允許 ASP 頁相對於目前目錄的路徑 (使用 ..\ 符號)。因為包含路徑可存取應用程式之根目錄外的重要或機密檔案,所以如果設定成 true
則此屬性會造成潛在的安全性風險。
HasItems
Item Name | TypeName | Item | Items | Contents | Count |
---|---|---|---|---|---|
ObjectContext | IASPObjectContext | False | False | False | False |
Server | IServer | False | False | False | False |
Application | IApplicationObject | True | False | True | False |
Application.Contents | IVariantDictionary | True | False | False | True |
Application.StaticObjects | IVariantDictionary | True | False | False | True |
Session | ISessionObject | True | False | True | False |
Session.Contents | IVariantDictionary | True | False | False | True |
Session.StaticObjects | IVariantDictionary | True | False | False | True |
Request | IRequest | True | False | False | False |
Response | IResponse | False | False | False | False |
Server.GetLastError | IASPError | False | False | False | False |
Request.ServerVariables | IRequestDictionary | True | False | False | True |
Request.ClientCertificate | IRequestDictionary | True | False | False | True |
Request.Cookies | IRequestDictionary | True | False | False | True |
Request.Form | IRequestDictionary | True | False | False | True |
Request.QueryString | IRequestDictionary | True | False | False | True |
Response | IResponse | False | False | False | False |
Response.Cookies | IRequestDictionary | True | False | False | True |
Request.Form("ID") | IStringList | True | False | False | True |
Request.QueryString("ID") | IStringList | True | False | False | True |
Request.Cookies("ID") | IReadCookie | True | False | False | True |
Request.ClientCertificate("Subject") | IRequestDictionary | True | False | False | True |
Request.ServerVariables("URL") | IStringList | True | False | False | True |
Server.CreateObject("ADODB.Connection") | Connection | False | False | False | False |
Server.CreateObject("ADODB.Recordset") | Recordset | False | False | False | False |
Server.CreateObject("Scripting.FileSystemObject") | FileSystemObject | False | False | False | False |
Server.CreateObject("Scripting.Dictionary") | Dictionary | True | True | False | True |