Asp.net
Asp.net - 嘗試訪問工作網頁時出現 <customErrors mode=‘Off’/> 錯誤
我創建了一個 asp.net 網頁並將其上傳到網路伺服器。但是,當我嘗試遠端查看頁面時,我在 web.config 文件中收到有關 customerror 標記的錯誤。該頁面在本地工作,沒有錯誤或警告。此外,如果我將頁面作為 .html 文件上傳,我可以遠端查看它。我見過很多其他人遇到此錯誤,但“解決方案”只是說將 customErrors 標記更改為“關閉”,我已經完成但不起作用,你知道網路伺服器有問題還是什麼可能是這裡的問題嗎?
這是錯誤頁面:
“/”應用程序中的伺服器錯誤。執行時錯誤描述:伺服器上發生應用程序錯誤。此應用程序的目前自定義錯誤 > 設置阻止遠端查看應用程序錯誤的詳細資訊(出於安全原因)。但是,它可以通過在本地伺服器機器上執行的瀏覽器來查看。
詳細資訊:要使此特定錯誤消息的詳細資訊可以在遠端 > 機器上查看,請在位於目前 Web 應用程序根目錄的“web.config”配置文件中創建一個標籤。該標籤 > 應將其“模式”屬性設置為“關閉”。
<configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>注意:您看到的目前錯誤頁面可以通過 > 修改應用程序的 >configuration 標記的“defaultRedirect”屬性以指向自定義錯誤頁面 URL 來替換為自定義錯誤頁面。
<configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>這是我的 web.config 文件:
<?xml version="1.0"?> <configuration> <system.web> <customErrors mode="Off"/> </system.web> <system.web> <compilation debug="true"/> <authentication mode="None"/> </system.web> </configuration>
你應該只有一個
<system.web>在你的Web.Config Configuration File.<?xml version="1.0"?> <configuration> <system.web> <customErrors mode="Off"/> <compilation debug="true"/> <authentication mode="None"/> </system.web> </configuration>