大文件上传仅在特定情况下工作的原因是什么?

huangapple go评论79阅读模式
英文:

Why are large file uploads working only under specific circumstances?

问题

我正在尝试将应用程序上的文件上传的最大文件大小增加到500 MB,该应用程序位于我的ColdFusion服务器上。我已经进行了ColdFusion管理和IIS更改,但当我上传一个437 MB的.zip文件并提交表单时,页面只显示“由于请求实体过大,未显示页面。”

这些是我所做的更改:

  • 在ColdFusion管理中,将“最大POST数据大小”的值从150 MB增加到500 MB
  • 在ColdFusion管理中,将“请求限制内存”的值从200 MB增加到550 MB
  • 在IIS中,将“默认网站”的“允许的最大内容长度”的值从30000000字节增加到576716800字节(550 MB)
  • 在IIS中,将“myApplication”的“允许的最大内容长度”的值从30000000字节增加到576716800字节
  • 在IIS中,将“默认网站”的“uploadReadAheadSize”的值从49152字节增加到576716800字节
  • 在IIS中,将“myApplication”的“uploadReadAheadSize”的值从49152字节增加到576716800字节

上述更改未解决问题。上传大文件(例如437 MB的.zip文件)确实有效,但仅当满足以下所有条件时才有效:

  1. 用于上传文件的表单位于应用程序的“index.cfm”文件中
  2. 表单提交到其所在的网页(例如,使用<form action="")而不是提交到其他页面
  3. URL指向应用程序的根目录(例如https://www.myserver.com/myApplication/,但如果我将URL从根目录更改为https://www.myserver.com/myApplication/index.cfm并尝试上传,则会失败,尽管这两个URL在功能上是相似的,如果不是相同的话)。
英文:

I'm trying to increase the maximum file size to 500 MB for uploads on an application on my ColdFusion server. I've made ColdFusion administration and IIS changes, but when I upload a 437 MB .zip file and submit the form, the page displays only "The page was not displayed because the request entity is too large."

These are the changes I've made:

  • In ColdFusion administration, increased the value of “Maximum size of post data” from 150 MB to 500 MB
  • In ColdFusion administration, increased the value of “Request Throttle Memory” from 200 MB to 550 MB
  • In IIS, increased the value of “Maximum allowed content length” for “Default Web Site” from 30000000 Bytes to 576716800 Bytes (550 MB)
  • In IIS, increased the value of “Maximum allowed content length” for “myApplication” from 30000000 Bytes to 576716800 Bytes
  • In IIS, increased the value of “uploadReadAheadSize” for “Default Web Site” from 49152 Bytes to 576716800 Bytes
  • In IIS, increased the value of “uploadReadAheadSize” for “myApplication” from 49152 Bytes to 576716800 Bytes

The changes above have not resolved the issue. Uploading a large file (such as the 437 MB .zip file) does work, however, if all of the following conditions are met:

  1. The form for uploading the file is located in the application’s “index.cfm” file
  2. The form submits to the web page it’s located in (by using <form action="", for example) rather than to some other page
  3. The URL is pointing at the root of the application (such as https://www.myserver.com/myApplication/, but if I change the URL from the root to https://www.myserver.com/myApplication/index.cfm and try the upload, it fails even though these two URLs are functionally similar if not identical)

答案1

得分: 0

最大值在 IIS 设置中为 104857600。

英文:

Maximum in IIS settings is 104857600

答案2

得分: 0

这个问题的解决方案原来依赖于 Jakarta 虚拟文件系统。我最近启用了详细的 IIS 日志记录,然后尝试了一个大文件上传。上传失败了,但在随后的详细错误页面中,有一个包含一个名为 "jakarta" 的目录的 URL。在 IIS 的连接窗格下,"Default Web Site" 中有一个名为 "jakarta" 的目录。对于这个 "jakarta" 目录,我决定将 "Request Filtering" 下的 "Maximum allowed content length (Bytes)" 增加到 550 MB,从而解决了这个问题。

总结一下,这些是使大文件上传正常工作而无需遵循我在原帖中概述的特定条件所需的唯一更改(我之前提到的任何其他 IIS 值我都恢复为默认值):

  • 在 IIS 中,将 "myApplication" 的 "Maximum allowed content length (Bytes)" 值增加到 550 MB
  • 在 IIS 中,将 "jakarta" 的 "Maximum allowed content length (Bytes)" 值增加到 550 MB
  • 在 ColdFusion 管理中,将 "Maximum size of post data" 的值增加到 500 MB
  • 在 ColdFusion 管理中,将 "Request Throttle Memory" 的值增加到 550 MB

感谢所有回复的人!

英文:

It turns out the solution to this issue hinged on Jakarta, the virtual file system. I recently enabled detailed IIS logging and then tried a large file upload. The upload failed, but in the ensuing detailed error page was a URL containing a directory called "jakarta." In the Connections pane in IIS under "Default Web Site" is a directory called "jakarta." For this "jakarta" directory I decided to increase "Maximum allowed content length (Bytes)" under Request Filtering to 550 MB, which resolved the problem.

In summary, these were the only changes needed to allow large file uploads to work without having to adhere to the specific conditions I outlined in my original post (any other IIS values I mentioned earlier I set back to default):

  • In IIS, increased the value of "Maximum allowed content length (Bytes)" for "myApplication" to 550 MB
  • In IIS, increased the value of "Maximum allowed content length (Bytes)" for "jakarta" to 550 MB
  • In ColdFusion administration, increased the value of “Maximum size of post data” to 500 MB
  • In ColdFusion administration, increased the value of “Request Throttle Memory” to 550 MB

Thank you to everyone who responded!

答案3

得分: -1

你可以通过修改 web.config 文件中的 maxAllowedContentLength 设置来增加最大文件大小:

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="2147483648" />
    </requestFiltering>
  </security>
</system.webServer>

通过上述的 maxAllowedContentLength 设置,用户可以上传大小为2 GB的文件。这个设置会立即生效,无需重新启动IIS服务。

英文:

You can increase the maximum file size by modify the maxAllowedContentLength setting in the web.config file:

&lt;system.webServer&gt;
  &lt;security&gt;
    &lt;requestFiltering&gt;
      &lt;requestLimits maxAllowedContentLength=&quot;2147483648&quot; /&gt;
    &lt;/requestFiltering&gt;
  &lt;/security&gt;
&lt;/system.webServer&gt;

With the above maxAllowedContentLength, users can upload files that are 2 GB in size. This setting will work right away without restart IIS services.

huangapple
  • 本文由 发表于 2023年7月27日 22:04:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76780555.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定