2012-07-30 6 views
3

내 MVC3 응용 프로그램은 사용자 정의 오류 403 페이지, 404, 500 개 상태 코드를 표시하지만 검색은 표시에게 다음과 같은 YSOD trace.axd에하기 :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으로 충분히 행복 할 것입니다. 단지 못생긴 노란색 화면이 아니면 안됩니다.

편집 : 로컬 호스트에서 실행 중일 때 YSOD와 함께 500 개를 얻었지만 실제로는 기대했던 것보다 가까운 서버에 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> 

답변

1

가 내가 그것을 해결 할 수 <deployment retail = "true" />을 제안 트위터에 @shanselman 질문에는 응답이 없었다,하지만 여전히 같은 YSOD을 반환하기 때문에.

결국 경로를 제거하여 해결했습니다 .IgnoreRoute ("{resource} .axd/{* pathInfo}"); 라우팅 설정에서. 상당히 바르지는 않지만 작동합니다.

1

@Cosmologinaut에서 제안한대로 IgnoreRoute를 제거하지 못했고 잘못된 생각이 들었습니다.

<system.webServer> 
    <!-- remove TraceHandler-Integrated - Remove the tracing handlers so that navigating to /trace.axd gives us a 
     404 Not Found instead of 500 Internal Server Error. --> 
    <handlers> 
     <remove name="TraceHandler-Integrated" /> 
     <remove name="TraceHandler-Integrated-4.0" /> 
    </handlers> 
    </system.webServer> 

지금 /trace.axd 우리에게 대신 500 내부 서버 오류 찾을 수 없음 (404)를 제공하기 위해 탐색 : 나는 Web.config 파일에서 추적 HTTP 처리기를 제거하는 것입니다 더 나은 솔루션을 발견했다.