asp.net - 找不到资源,而不是超过41​​3个请求长度

标签 asp.net iis httpfilecollection

当我尝试上传大文件(超过10MB)时,我的页面向我显示:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.


我的web.config有这个
<httpRuntime requestValidationMode="2.0" maxRequestLength="15000" />
<customErrors mode="RemoteOnly" defaultRedirect="~/Errorhandling.aspx">
      <error statusCode="404" redirect="~/NotFound.html" />
       <error statusCode="413" redirect="~/TooBig.html" />
</customErrors>
为什么不将我重定向到TooBig.html而不显示上述消息?
笔记
默认的ASP.NET允许为4MB,这就是为什么我将maxRequestLength更改为15000的原因。(此时将其更改为150000并没有什么区别,因为我最多只能测试10MB)

最佳答案

在使用不同大小的文件迁移到IIS7时遇到了这个问题。但是下面的解决方案当时对我有用。您应该将这些部分添加到您的webconfig或appconfig文件中,具体取决于所需的范围。

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

有关更多信息,请参见。

http://www.webtrenches.com/post.cfm/iis7-file-upload-size-limits

关于asp.net - 找不到资源,而不是超过41​​3个请求长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15413566/

相关文章:

asp.net - 在 ASP .NET 页面生命周期中何时触发 DataBinding 事件?

c# - 如果我们修改了aspx页面中的部分代码,是否必须重新发布网站?

c# - 如何在运行时将文件复制到虚拟路径

c# - SignalR IIS 工作进程未释放

azure - 在 WebApp 中禁用快速失败保护

ssl - .netcore 应用程序的 wwwroot 之外的静态文件

c# - 使用 Lambda 表达式计算 HttpFileCollection 的总内容长度

c# - ASP GridView 在单击按钮时获取行值