3

これは、プログラミング情報のこの素晴らしい情報源に関する私の最初の投稿です。

私はクライアントのために新しいサイトを開発し、いくつかの仕上げを行っています。

web.configから読み取られるカスタムエラーページを作成しようとしています

 <system.web>
 <customErrors mode="RemoteOnly">
           <error statusCode="404" redirect="404.aspx" />
           <error statusCode="500" redirect="500.aspx" />
    </customErrors>

ローカル開発マシンでうまく機能し、必要に応じて404エラーと500エラーが表示されます。

サイトをコンパイルしてWebサーバーに公開した後は、機能しません。IIS 6は、次の404エラーのような元のIIS6エラーページを表示し続けます。

The page cannot be found

The page you are looking for might have been removed, 
had its name changed, or is temporarily unavailable. 
Please try the following:

Make sure that the Web site address displayed in the address bar of 
your browser is spelled and formatted correctly.

If you reached this page by clicking a link, contact the Web site 
administrator to alert them that the link is incorrectly formatted.

Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)

なぜこれを行うのかわかりません。web.configが元のIIS6設定を上書きすると思いました。


問題は404.aspxページのみにあることがわかりました。エラー500は正常に機能しており、500.aspxページが表示されています。ただし、404.aspxの場合はそうではありません。ご意見をお聞かせください

4

1 に答える 1

2

Web 構成は、要求が .NET ISAPI フィルターに渡される場合 (たとえば、.aspx で終わるページの場合) にのみ IIS6 設定をオーバーライドします。

.NET ISAPI にアクセスできないファイルまたはディレクトリを参照すると、web.config ルールが使用されません。

于 2010-01-28T10:58:01.417 に答える