0

私はこのウェブ設定を持っています:

<?xml version="1.0"?>

<configuration>
  <configSections>
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <!--maxRequestLength = maximum upload size =- 4096KB = 4MB-->
    <httpRuntime maxRequestLength="409600000"/>
  </system.web>

  <system.webServer>
    <rewrite>
      <rules>
        <!--The following rule will only work when published-->
        <rule name="Construction" stopProcessing="true">
          <match url="Construction\.aspx" negate="true"/>
          <conditions>
            <!-- dont ignore my own ip -->
            <add input="{REMOTE_ADDR}" pattern="XXX.XXX.XXX.XXX" negate="true"/>
          </conditions>
          <action type="Redirect" url="Construction.aspx" redirectType="Found"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

</configuration>

ローカル マシンの IIS では動作しますが、他のマシンでは次の問題が発生します。

  1. rewriteその部分が含まれていると 500 エラーが発生します。削除すると、すべて正常に動作します。
  2. デバッグ出力を画面に出力できません。

どうしたの?

4

4 に答える 4

0

以下の構成を試すことができます。これには、フォルダーに来るリクエストを index.php ページにリダイレクトする書き換えブロックがあり、カスタム/汎用エラー ページの代わりに詳細なエラーも出力します。これは、IIS 8.5 をホストする Godaddy ウィンドウでテストされています。お役に立てれば!

<configuration>
 <system.webServer>
    <httpErrors errorMode="Detailed"></httpErrors>
    <asp scriptErrorSentToBrowser="true"></asp>
    <rewrite>
     <rules>
      <rule name="your rule" stopProcessing="true">
       <match url="(.*)$"  ignoreCase="false" />
       <conditions>        
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />        
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />        
       </conditions> 
       <action type="Rewrite" url="index.php?request={R:1}"  appendQueryString="true" />
      </rule>
     </rules>
    </rewrite>
  </system.webServer>
  <system.web>
    <customErrors mode="Off"></customErrors>
    <compilation debug="true"></compilation>
  </system.web>
</configuration>
于 2016-05-09T14:33:57.387 に答える
0

< configuration > タグに追加することしかできませんでした:

<configSections>
      <sectionGroup name="system.webServer">
           <sectionGroup name="rewrite">
                <section name="rewriteMaps" overrideModeDefault="Allow" />
                <section name="rules" overrideModeDefault="Allow" />
           </sectionGroup>
     </sectionGroup>
</configSections>

そのため、エラーは発生しませんが、書き換えも読み取りません

于 2013-11-05T20:53:18.350 に答える
0

を使用する場合rewrite、マッチの url 属性でピリオドをエスケープしていません。試しました<match url="^Construction.aspx$" negate="true"/>か?

確かに、これについてドキュメントを掘り下げてからしばらく経っているので、これはストレッチです。

于 2013-02-12T14:42:36.437 に答える