iis-7 - 避免上传大于 10mb 的文件

标签 iis-7 file-upload

有什么方法(可能是模块)可以使 IIS7 拒绝文件大于 10mb 的帖子?

我的 ASP.NET 应用程序有一个上传页面,文件不能大于 10mb,我相信只有在所有内容都发送到服务器后才能检查文件的大小。

IIS7 模块将是正确的选择,有人知道吗?

最佳答案

您可以在 Web.Config 中设置限制

<system.web>
  <httpRuntime  maxRequestLength="xxxxx" executionTimeout="xx"/>
</system.web> 

边注:

默认情况下,IIS7 将拒绝任何大于 30 兆的文件,您可以通过添加以下代码来增加它
<security>
 <requestFiltering>
  <requestLimits maxAllowedContentLength=”XXXXXX″ />
 </requestFiltering>
</security>

如果您希望在上传之前获取内容大小,您应该能够使用 HTTP 方法 HEAD 来检索 Content-Length。

Implementation

关于iis-7 - 避免上传大于 10mb 的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/533039/

相关文章:

javascript - 将文件从客户端上传到 Azure Blob 存储 | MVC

http - 如何取消在 Flutter 中使用 http.MultipartRequest() 发送的正在进行的文件上传?

asp.net - 在管道模式 = 集成的 iis 7.5 上托管后 Css 不应用

apache - 经典 ASP 启用 Windows 身份验证但 Request.ServerVariables (“LOGON_USER” ) 有时会返回错误的用户名

iis-7 - Rotativa PDF生成在本地运行,但不能在IIS 7上运行

IIS 7.5 : How to let him serve by default all file extensions (without manually adding them)?

javascript - 文件上传:如何上传外部云文件夹中的文件javascript修改

php - 诊断 "The connection to localhost was interrupted"

java - 无法使用 HttpClient POST 请求上传文件

javascript - uploadcare使用js存储到s3