Remove the size limit of ASP. NET uploaded files
Today I made an upload function, using the FileUPLoad of vs2005. After trying to upload several times, I found this problem. If the number of uploaded files is less than 4 MB, everything is normal, however, if it exceeds the limit, a page with about: blank appears, and the problem is found later. It turns out to be like this: ASP. NET by default, ASP.. NET file size limit is 4 MB.
The solution is also simple: add
- <configuration>
- <system.web>
- <httpRuntimemaxRequestLengthhttpRuntimemaxRequestLength="1048576"
executionTimeout="3600"/>
- system.web>
- configuration>
That's all. MaxRequestLength: indicates the maximum number of bytes uploaded by ASP. NET over HTTP. This restriction can be used to prevent DoS attacks caused by a large number of files being transferred to the server. The specified size is in KB. The default value is 4096 KB (4 MB ). ExecutionTimeout: indicates the maximum number of seconds allowed to execute a request before it is automatically disabled by ASP. NET. When the file size exceeds the specified size, if a DNS error occurs in the browser or the service is unavailable, modify the above configuration to increase the number of configurations.
In addition, this problem may occur when ASP. NET uploads files: aspnet_wp.exe (PID: 1520) is recycled because the memory consumption exceeds 60 of 460 MB of available RAM ). If this error message is returned, the memoryLimit attribute value is added to WebConfig. For example:
- <configuration>
- <system.web>
- <processModelmemoryLimitprocessModelmemoryLimit="80"/>
- system.web>
- configuration>
The above is to lift the size limit of ASP. NET files to increase the memory usage to 80%.
- Use Web Parts in ASP. NET 2.0
- JavaScript and ASP. NET controls Integration
- ASP. NET authentication and authorization
- Introduction to ASP. NET 2.0 Virtual Hosts
- Asp. Net dynamic page Conversion