我MVC3應用程序顯示403自定義錯誤頁,404和500個狀態碼,但瀏覽到的trace.axd顯示以下YSOD:如何獲得MVC3中trace.axd的自定義錯誤頁面?
Server Error in '/' Application.
Trace Error
Description: Trace.axd is not enabled in the configuration file for this application. Note: Trace is never enabled when <deployment retail=true />
Details: To enable trace.axd, please create a <trace> tag within the configuration file located in the root directory of the current web application. This <trace> tag should then have its "enabled" attribute set to "true".
<configuration>
<system.web>
<trace enabled="true"/>
</system.web>
</configuration>
所以我有微量禁用,這是好的,但爲什麼沒有顯示500頁面,因爲這是從服務器返回的403頁面?我真的很高興404,403,或500真的 - 只要它不是一個醜陋的黃色屏幕!
編輯:我在本地主機上運行時得到了一個500與YSOD,但它實際上是一個403服務器上接近我所期望的 - 但仍然沒有自定義錯誤頁面。這也是在服務器上略有不同的標準錯誤頁:
Server Error in '/' Application.
Trace Error
Description: The current trace settings prevent trace.axd from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable trace.axd to be viewable on remote machines, please create a <trace> tag within the configuration file located in the root directory of the current web application. This <trace> tag should then have its "localOnly" attribute set to "false".
<configuration>
<system.web>
<trace localOnly="false"/>
</system.web>
</configuration>