63

画像をアップロードしたいのですが、自分のマシンでは問題なく動作しますが、自分のWebサイトをIIS7サーバーに公開すると、何もアップロードできません。

エラー

要求フィルタリングモジュールは、要求コンテンツの長さを超える要求を拒否するように構成されています。

最も考えられる原因

コンテンツの長さが構成された値を超えているため、要求フィルタリングは要求を拒否するようにWebサーバーで構成されています。

あなたが試すことができること

applicationhost.configまたはweb.configファイルのconfiguration/system.webServer / security / requestFiltering / requestLimits@maxAllowedContentLength設定を確認します。

Web.configのsystem.webServer

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1048576" />
      </requestFiltering>
   </security>
  </system.webServer>

ご覧のとおり、maxAllowedContentLengthを1GBに設定しました。Webサイトを再起動しても、このエラーが発生します。私は/uploads/自分のファイルシステム上に、それもあるはずのフォルダを作成しました。このエラーの原因と、画像をアップロードできない理由がわかりません。

4

3 に答える 3

45
<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

ここから。

IIS7以降の場合は、以下の行も追加する必要があります。

 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>
于 2012-06-03T16:41:42.187 に答える
3

次のWeb.configファイルの例では、「Content-type」ヘッダーの長さが100バイトを超えるHTTP要求へのアクセスを拒否するようにIISを構成します。

  <configuration>
   <system.webServer>
      <security>
         <requestFiltering>
            <requestLimits>
               <headerLimits>
                  <add header="Content-type" sizeLimit="100" />
               </headerLimits>
            </requestLimits>
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

ソース:http ://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

于 2015-01-12T18:14:49.153 に答える
0

同様の問題がありました。「C:\ Windows \ System32 \ inetsrv\config」ディレクトリにあるapplicationhost.configファイルのrequestlimitsmaxAllowedContentLength="40000000"セクションを変更することで解決しました。

セキュリティセクションを探し、sectionGroupを追加します。

<sectionGroup name="requestfiltering">
    <section name="requestlimits" maxAllowedContentLength ="40000000" />
</sectionGroup>

*注削除;

<section name="requestfiltering" overrideModeDefault="Deny" />
于 2018-05-07T21:07:21.113 に答える