大文件无法通过我的 js 插件上传
Big files aren't uploading through my js plugin
我做了一个小的(jQuery + ajax + 后端)文件上传插件。当我测试这个插件时,我注意到有些文件没有上传到我的服务器(他们给了我一个例外)。然后,我意识到问题出在它们的大小上:较小的进展顺利,但较大的则不然。然后我制作了一个由符号组成的垃圾txt文件,以计算文件大小配额是多少。因此,4 194 116 b 之前的文件通过,4 194 117 之后的文件不通过。
不知道是js的问题,还是ajax的问题,甚至是IIS和Visual Studio的问题。我应该如何检查问题出在哪里或带宽选项?
TL;DR: Files bigger than 4194116 bytes are not being uploaded by js.
更新 1: 我知道 web.config 中的请求大小设置。设置正确:
<system.web>
<httpRuntime maxRequestLength="153600" executionTimeout="60" /><!--150MB (in kbytes) & 60s timeout-->
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="157286400" /> <!--150MB (in bytes)-->
</requestFiltering>
</security>
</system.webServer>
发现问题。我只是在 View
的 Web.config
中设置了限制,但它应该在根目录中的主要 Web.config
中。
我做了一个小的(jQuery + ajax + 后端)文件上传插件。当我测试这个插件时,我注意到有些文件没有上传到我的服务器(他们给了我一个例外)。然后,我意识到问题出在它们的大小上:较小的进展顺利,但较大的则不然。然后我制作了一个由符号组成的垃圾txt文件,以计算文件大小配额是多少。因此,4 194 116 b 之前的文件通过,4 194 117 之后的文件不通过。
不知道是js的问题,还是ajax的问题,甚至是IIS和Visual Studio的问题。我应该如何检查问题出在哪里或带宽选项?
TL;DR: Files bigger than 4194116 bytes are not being uploaded by js.
更新 1: 我知道 web.config 中的请求大小设置。设置正确:
<system.web>
<httpRuntime maxRequestLength="153600" executionTimeout="60" /><!--150MB (in kbytes) & 60s timeout-->
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="157286400" /> <!--150MB (in bytes)-->
</requestFiltering>
</security>
</system.webServer>
发现问题。我只是在 View
的 Web.config
中设置了限制,但它应该在根目录中的主要 Web.config
中。