ASP.NET网站大附件上传配置
2012-10-25 16:50
483 查看
NET应用程序上传文件大小限制并非都是IIS的原因,也有可能是应用程序自身设置造成的,在使用过程中一定要区分开来,这样才能做到正确的设置。
1..NET应用程序限制上传文件大小:超过了最大请求长度
这类错误就是由于应用程序自身设置造成的。只需在web.config的<system.web>节加入以下内容即可:
2.IIS限制上传文件大小:请求筛选模块被配置为拒绝超过请求内容长度的请求
这类错误是由于IIS7.0限制上传文件大小为30000000字节(约28.6M)造成的。打开C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml,找到如下内容:
将maxAllowedContentLength的默认值修改成合适大小即可,单位为字节。
IIS_schema.xml默认是无法修改的,即使是系统管理员也不行,必需修改下权限,再去掉其只读属性才可修改。
直接点击"编辑"按钮你会发现权限是不能修改的,还得先做如下操作:
1).点击"高级"按钮进入高级安全设置界面;
2).切换到"所有者"选项卡,点"编辑"按钮,选中Administrators后确定;
然后可以在"安全"选项卡上点击"编辑"按钮,给Administrators增加修改和写入权限了,再去掉IIS_schema.xml只读属性,系统管理员就可以修改文件了。
(感谢原作者提供的解决方案,亲测可用,很好很强大。)
1..NET应用程序限制上传文件大小:超过了最大请求长度
这类错误就是由于应用程序自身设置造成的。只需在web.config的<system.web>节加入以下内容即可:
<configuration> <system.web> <!-- maxRequestLength单位KB,executionTimeout单位是秒 --> <httpRuntime maxRequestLength="51200" useFullyQualifiedRedirectUrl="true" executionTimeout="43200"/> </system.web> </configuration>
2.IIS限制上传文件大小:请求筛选模块被配置为拒绝超过请求内容长度的请求
这类错误是由于IIS7.0限制上传文件大小为30000000字节(约28.6M)造成的。打开C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml,找到如下内容:
<element name="requestLimits"> <attribute name="maxAllowedContentLength" type="uint" defaultValue="30000000" /> <attribute name="maxUrl" type="uint" defaultValue="4096" /> <attribute name="maxQueryString" type="uint" defaultValue="2048" /> <element name="headerLimits"> <collection addElement="add" clearElement="clear" removeElement="remove" > <attribute name="header" type="string" required="true" isUniqueKey="true" validationType="nonEmptyString" /> <attribute name="sizeLimit" type="uint" required="true" /> </collection> </element> </element>
将maxAllowedContentLength的默认值修改成合适大小即可,单位为字节。
IIS_schema.xml默认是无法修改的,即使是系统管理员也不行,必需修改下权限,再去掉其只读属性才可修改。
直接点击"编辑"按钮你会发现权限是不能修改的,还得先做如下操作:
1).点击"高级"按钮进入高级安全设置界面;
2).切换到"所有者"选项卡,点"编辑"按钮,选中Administrators后确定;
然后可以在"安全"选项卡上点击"编辑"按钮,给Administrators增加修改和写入权限了,再去掉IIS_schema.xml只读属性,系统管理员就可以修改文件了。
(感谢原作者提供的解决方案,亲测可用,很好很强大。)
相关文章推荐
- 做完一个小网站的一点经验总结(2):asp.netaccess程序运行环境的配置
- 在IIS6中配置asp.net MVC网站时HTTP 错误 500.21 - Internal Server Error解决方案
- Asp.net网站的ClickOnce自动部署(3)-虚拟目录的配置
- ASP.NET环境下配置FCKEditor并上传图片及其它文件
- ASP.NET中关于上传附件的大小设置问题
- 网站发布—图解Win7旗舰版中的IIS配置asp.net运行环境(一)
- Asp.net网站管理工具来配置membership
- Asp.Net多附件上传
- IIS6 配置ASP.NET网站伪静态
- (仿163)Asp.Net多附件上传
- ASP.NET网站开发——个性化用户配置概述
- ASP.Net上传大文件解决方案之IIS7.0下的配置
- 未能将网站配置为使用ASP.NET4.X 解决方法
- Asp.Net网站部署-上传文件限制解决方案
- IIS限制ASP.Net 文件上传大小解决方案,修改IIS7/7.5配置
- ASP.Net网站管理工具配置
- SVN 导出代码在VS2012运行提示“未能将网站xx 配置为使用 ASP.NET 4.0,为了使此网站正确运行,您必须将它手动配置为使用 ASP.NET 4.0”
- asp.net配置文件上传大小限制和超时时间。
- ASP.NET MVC 网站开发总结(二)——一个或多个文件的异步或同步上传
- asp.net 无刷新附件上传实现方法