我怎样才能得到一个自定义错误页的MVC3的trace.axd? [英] How can I get a custom error page for trace.axd in MVC3?
问题描述
我MVC3应用程序显示403,404自定义错误页,和500状态codeS,但浏览到的trace.axd显示以下YSOD:
在'/'应用程序的服务器错误。 跟踪误差 说明:的trace.axd没有此应用程序的配置文件中启用。注:跟踪是从未启用时<部署的零售=真/> 详细信息:要启用的trace.axd,请创建<跟踪和GT;在位于当前Web应用程序的根目录下的配置文件中的标签。该<跟踪和GT;然后标记应该有它的已启用属性设置为真。 <结构>
<&的System.Web GT;
<跟踪启用=真/>
< /system.web>
< /结构>
所以我一直跟踪残疾,这是好的,但为什么没有被显示在页面上500,因为这个它正在从服务器返回一个403?我很乐意足以与404,403,或500真 - !只要你将它不是一个丑陋的黄色画面
编辑:我正与在本地主机上运行时,YSOD沿着500,但它实际上是一个403的更靠近我期待在服务器上 - 但仍然没有自定义错误页。这也是在服务器上略有不同的标准错误页:
在'/'应用程序的服务器错误。跟踪误差说明:从远程查看(出于安全原因)当前跟踪设置prevent的trace.axd。它可以,但是,可以通过在本地服务器计算机上运行的浏览器查看。详细信息:若要使的trace.axd是在远程计算机上查看,请创建<跟踪和GT;在位于当前Web应用程序的根目录下的配置文件中的标签。该<跟踪和GT;那么标签应该有它的设置LocalOnly属性设置为假。<结构>
<&的System.Web GT;
<跟踪设置LocalOnly =FALSE/>
< /system.web>
< /结构>
由于没有回答,我问@shanselman在Twitter上,谁建议<部署的零售=真/>
可能解决它,但它仍然返回相同YSOD。
在最后我解决它通过删除routes.IgnoreRoute({}资源个.axd / {*} PATHINFO);从路由配置。没有相当似乎是正确的,但它的工作原理。
My MVC3 application displays custom error pages for 403, 404, and 500 status codes, but browsing to trace.axd displays the following YSOD:
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>
So I have trace disabled, which is good, but why is the 500 page not being displayed, since this it's a 403 being returned from the server? I'd be happy enough with a 404, 403, or 500 really - just as long as it's not an ugly yellow screen!
Edit: I was getting a 500 along with the YSOD when running on localhost, but it's actually a 403 on the server which is closer to what I was expecting - but still no custom error page. It's also a slightly different standard error page on the server:
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>
Since there were no responses I asked @shanselman on Twitter, who suggested <deployment retail = "true" />
might solve it, but it still returned the same YSOD.
In the end I solved it by removing routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); from the routing config. Doesn't quite seem right, but it works.
这篇关于我怎样才能得到一个自定义错误页的MVC3的trace.axd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!