设置IIS7文件上传的最大大小
2023-06-13 09:11:02 时间
设置IIS7文件上传的最大大小 maxAllowedContentLength,maxRequestLength
PS:IIS7.5只能上传2M的数据,超过2M,程序会出现错误。
解决方案:
- IIS修改方案:
- 修改IIS的
applicationhost.config
打开%windir%\system32\inetsrv\config\applicationhost.config
找到: 节点, 这个节点默认没有 元素,IIS 7和IIS 7.5上测试过 最大值只能是 <4GB, 为这个节点新增如下事例元素: ,上传的大小将改为2G
注意:%windir%\system32\inetsrv\config\applicationhost.config
文件一定不要用其他机器的文件替换,否则IIS将无法启动
此文件记录了,当前IIS中所有Site , App pool的信息,还有一些与机器相关的配置。
- 修改web.config
<system.web>
<httpRuntime executionTimeout="36000" maxRequestLength="2097151"/>
system.web>
注意:这个maxRequestLength最大值只能是2097151K,设置大于这个值将会出现如下错误:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The value for the property 'maxRequestLength' is not valid. The error is: The value must be inside the range 0-2097151.
Source Error:
C:\Windows\System32\inetsrv>appcmd set config "Default Web Site/owa" -section:re
questFiltering -requestLimits.maxAllowedContentLength:1024000
- web.config下如果有如下节点(此节点是为IIS 7设计的) ,则修改
14484320.06614
- 单位与applicationhost.config中的 一致,它的最大值也只能为4294967295
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647"/>
requestFiltering>
security>
system.webServer>
相关文章
- Spring MVC框架:第九章:文件上传
- java web文件上传——FileUpload
- Go读取yaml文件到struct类
- 站点 robots 文件在线生成
- Class类文件结构详解编程语言
- java文件上传–基于ajaxFileUpload+struts2详解编程语言
- springboot 文件上传大小配置详解编程语言
- ABAP-TXT文件上传详解编程语言
- Linux下覆盖询问:避免文件被意外覆盖(linux覆盖询问)
- Linux下文件挂载命令指南(linux文件挂载命令)
- Linux文件改名:mv命令实现(linux文件改名命令)
- 如何在Linux中使用rm命令后找回文件?(linuxrm找回)
- Linux实时查看最新文件内容(linux动态查看文件)
- MySQL 压缩文件操作zip文件的导入和导出(mysql zip文件)
- jsp计数器-jsp文件
- PHP中,文件上传
- Asp下实现多表单域无组件文件上传的实例
- js获取判断上传文件后缀名的示例代码
- php设置允许大文件上传示例代码