如何处理“(413)请求实体太大”?

时间:2014-07-21 06:22:18

标签: c# asp.net-mvc asp.net-mvc-4

我已经阅读了一些答案,但没有一个能帮助我。也许我根本不理解它们,但无论如何:

远程服务器返回错误:(413)请求实体太大。 当我尝试上传文件而我无法找到原因时会发生这种情况,为什么? 当我尝试从* .srv.cs调用方法时会发生这种情况。

我读到问题可以在<httpRuntime maxRequestLength...,但我有161 kb文件的编号。

此外,绑定从http更改为https后出现此问题。在这里:http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx 我读过这个问题可能与UploadReadAheadSize有关但我在IIS中更改了它并没有发生任何事情。

这是来自.srv Web.config的绑定:

<bindings>
  <basicHttpsBinding>
    <binding name="BasicHttpsBinding" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </basicHttpsBinding>
</bindings>



<services>
  <service name="BusinessServices.Business" behaviorConfiguration="CustomeBehavior">
  </service>
</services>

和行为:

<behaviors>
      <serviceBehaviors>
        <behavior name="CustomeBehavior">
          <serviceAuthorization principalPermissionMode="Custom">
            <authorizationPolicies>
              <add policyType="Security.BusinessAuthorizationPolicy, Security" />
            </authorizationPolicies>
          </serviceAuthorization>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior name="SecurityOff">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />

我错过了什么吗?

修改 我已经尝试过了:http://tips4sysadmins.blogspot.com/2012/12/iis-75-uploadreadaheadsize.html (来自Request Too Large)并没有任何改变,所以不,这对我来说不是答案。

编辑2: 当我部署我的项目时,azure上出现了同样的问题,所以我猜,问题不在于IIS

0 个答案:

没有答案