当前位置:网站首页>解决asp.net上传文件时文件太大导致的错误
解决asp.net上传文件时文件太大导致的错误
2022-07-25 14:59:00 【Kimizhou_blog】
即使在web.config中添加了节点和设置依然是不行的,还是报文件太大的错误,
<httpModules>
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload"/>
</httpModules>
<httpRuntime executionTimeout="6000000000" maxRequestLength="900000000" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" maxQueryStringLength="10240" />
解决方法需要做到以下三个才能解决问题:
1:在web.config文件中,的configuration节点下的第一个节点添加如下节点:
<configuration>
<!--解决上传文件太大的错误 -->
<configSections>
<sectionGroup name="system.web">
<section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
</sectionGroup>
</configSections>2:在web.config文件下的system.web的节点下添加如下节点
<system.web>
<neatUpload useHttpModule="false" maxNormalRequestLength="40960000" maxRequestLength="20971510000" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>3:这个时候你会发现本地是可以上传成功了,但是在IIS上依旧不行,你需要在IIS中去设置IIS的上传大小,设置方法如下:
修改IIS的applicationhost.config
文件位置: %windir%/system32/inetsrv/config/applicationhost.config
找到<requestFiltering>节点,注意requestFiltering节点默认下面是没有requestLimits 节点的,你需要添加如下节点,当然,如果节点已经存在,则只需修改
为这个节点添加如下元素:
<requestLimits maxAllowedContentLength="2147483647" /> (上传的大小将改为2G)
这个时候你会发现已经OK了。
注意:在除了修改IIS文件的办法,修改配置文件也可以,亲身体验过:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="10240" maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>边栏推荐
- Splice a field of the list set into a single string
- "Ask every day" briefly talk about JMM / talk about your understanding of JMM
- [C题目]力扣876. 链表的中间结点
- Syntax summary of easygui
- The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%
- Go语言创始人从Google离职
- Number of high-quality number pairs [bit operation characteristics + abstract ability evaluation + grouping fast statistics]
- Development of uni app offline ID card identification plug-in based on paddleocr
- Leetcode-198- house raiding
- LeetCode_字符串_中等_151.颠倒字符串中的单词
猜你喜欢

河源市区推出消防安全主题奶茶 助推夏季火灾防控

32 chrome调试工具的使用

41 picture background synthesis - colorful navigation map

Go language founder leaves Google

EDA chip design solution based on AMD epyc server

SQL优化的一些建议,希望可以帮到和我一样被SQL折磨的你

51 single chip microcomputer learning notes (2)
![[MySQL series] - how much do you know about the index](/img/d7/5045a846580be106e2bf16d7b30581.png)
[MySQL series] - how much do you know about the index

Yarn: the file yarn.ps1 cannot be loaded because running scripts is prohibited on this system.

39 简洁版小米侧边栏练习
随机推荐
LeetCode_字符串_中等_151.颠倒字符串中的单词
"Ask every day" briefly talk about JMM / talk about your understanding of JMM
Realsense ROS installation configuration introduction and problem solving
PHP implements non blocking (concurrent) request mode through native curl
BigDecimal rounds the data
44 新浪导航 ,小米边栏 练习
Thymeleaf controls whether display is displayed through style
The concept and operation rules of calculus of variations
Awk from getting started to digging in (20) awk parsing command line parameters
(原创)自定义一个滚屏的RecyclerView
GameFramework制作游戏(二)制作UI界面
43 box model
C language and SQL Server database technology
Awk from getting started to digging in (21) awk script debugging
Spark 参数配置的几种方法
Niuke multi school E G J L
The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%
Filters get the data in data; Filters use data in data
39 简洁版小米侧边栏练习
C language and SQL Server database technology