5

私のMVC3アプリケーションは、403、404、および500ステータスコードのカスタムエラーページを表示しますが、trace.axdを参照すると、次の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>

トレースを無効にしましたが、これは良いことですが、サーバーから返された403であるため、500ページが表示されないのはなぜですか?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>
4

2 に答える 2

3

@Cosmologinautによって提案されたようにIgnoreRouteを削除することは私にとってはうまくいきませんでした、そして彼が言うように気分が悪いです。Web.configファイルでトレースHTTPハンドラーを削除することであるより良い解決策を見つけました:

  <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 InternalServerErrorではなく404NotFoundが表示されるようになりました。

于 2015-03-04T11:24:11.690 に答える
1

回答がなかったので、ツイッターで@shanselmanに聞いたところ、<deployment retail = "true" />解決するかもしれないと提案されましたが、それでも同じYSODが返されました。

最終的に、routes.IgnoreRoute( "{resource} .axd / {* pathInfo}");を削除して解決しました。ルーティング構成から。正しくないようですが、機能します。

于 2013-08-22T13:35:30.947 に答える