開發網頁程式時,有時最讓人苦惱的是,程式出了問題卻不知道到底錯在哪裡?如果您在 IIS7 上開發 ASP 時出了問題,預設會顯示的錯誤訊息是:
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
… 很好,我要去問誰呢?
會出現這個錯誤訊息的原因,是在 IIS 7 中 ASP 的偵錯訊息是預設關閉的!以下我們就要說明如何在 IIS7 中將偵錯訊息打開,提升我們開發時偵錯的效率。
設定的步驟如下:
1. 請先進入 IIS 管理員。
2. 選擇您要設定的站台,接著選按中間 IIS > ASP 的圖示。
3. 請修改 偵錯內容 > 將錯誤傳送到瀏覽器 為 「True」,再按右方的 套用。
如此一來即可在瀏覽 ASP 頁面顯示詳細的錯誤訊息,甚至有行號呢!