当我试图在我的网站上上传视频时,我得到错误的最大请求长度超过了。
我怎么解决这个问题?
当我试图在我的网站上上传视频时,我得到错误的最大请求长度超过了。
我怎么解决这个问题?
当前回答
值得注意的是,您可能希望将此更改限制为您希望用于上传的URL,而不是整个网站。
<location path="Documents/Upload">
<system.web>
<!-- 50MB in kilobytes, default is 4096 or 4MB-->
<httpRuntime maxRequestLength="51200" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 50MB in bytes, default is 30000000 or approx. 28.6102 Mb-->
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
</location>
其他回答
我被我们的网绊倒了。配置文件有多个系统。web部分:当我添加< httpRuntime maxRequestLength="1048576" />到系统时,它工作了。Web部分的配置级别。
把所有的答案总结在一个地方:
<system.web>
<httpRuntime targetFramework="4.5.2" maxRequestLength="1048576"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
规则:
maxRequestLength(以kb表示)值必须匹配 maxAllowedContentLength(以字节表示)。 大多数时候是你的系统。web section可能已经包含了一个“httpRuntime”。将你的targetFramework设置为你使用的。net版本。
注:
maxRequestLength的默认值是4096 (4mb)。最大值为2147,483,647 maxAllowedContentLength的默认值是30,000,000(大约30mb)。最大值为4,294,967,295
更多信息MSDN
如果你有一个请求到站点中的应用程序,确保你在根web.config中设置了maxRequestLength。应用程序web中的maxRequestLength。Config似乎被忽略了。
我必须编辑C:\Windows\System32\inetsrv\config\applicationHost。将<requestLimits maxAllowedContentLength="1073741824" />添加到…
<configuration>
<system.webServer>
<security>
<requestFiltering>
部分。
根据这篇微软支持文章
这里如ex.我采取1024 (1MB) maxAllowedContentLength(长度字节)应该与你的maxRequestLength(1048576字节= 1MB)相同。
<system.web>
<httpRuntime maxRequestLength="1024" executionTimeout="3600" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576"/>
</requestFiltering>
</security>
</system.webServer>