【问题标题】:Weird issue on: 413 Request Entity Too Large?奇怪的问题:413 请求实体太大?
【发布时间】:2016-06-28 22:31:00
【问题描述】:

我正在尝试使用下面的自定义 C# 库来上传文件。

Http-Multipart-Data-Parser https://github.com/Vodurden/Http-Multipart-Data-Parser

但我遇到了错误:413 Request Entity Too Large

我在 Google 上搜索了一整天,但仍然无法解决问题。我仍然遇到同样的错误。

如果我使用的是独立的 FileUpload 控件,我可以毫无问题地上传大文件。

在我的 web.config 中,我有:

<system.web>
    <httpRuntime executionTimeout="9999" maxRequestLength="419430400" />
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

知道如何解决这个问题吗?还是使用其他组件上传大文件?

我正在使用带有 VS 2010 的 IIS 10.0,tks

【问题讨论】:

    标签: c# file-upload


    【解决方案1】:

    我自己通过以下设置找到了答案:

    1) 在 web.config 中添加以下类似内容:

      <system.serviceModel>
        <bindings>
          <webHttpBinding>
            <binding
              maxBufferPoolSize="2147483647"
              maxReceivedMessageSize="2147483647"
              maxBufferSize="2147483647" transferMode="Streamed">
            </binding>
          </webHttpBinding>
        </bindings>
     </system.serviceModel>
    

    2) 在 IIS 中,更新以下设置:

    • 转到站点,在“管理”下归档配置编辑器
    • 转到中的部分
      • system.webServer/security/authentication/anonymousAuthentication
      • system.webServer/security/authentication/windowsAuthentication
    • 选择自:ApplicationHost.config ' />
    • 解锁部分

    要提一提的是 maxRequestLength 的设置好像没有 web.config 中不再需要。

    【讨论】:

      猜你喜欢
      • 2014-12-30
      • 2014-12-23
      • 2014-08-09
      • 2012-09-23
      • 2015-10-04
      • 2015-01-25
      • 2014-12-04
      • 2017-08-28
      相关资源
      最近更新 更多