ASP.NET - connection was reset error when uploading large size of file(45mb)

Asked By mani on 13-Feb-12 02:37 AM
hi..developed application..all are ok..but when i uploading large size of file more that 45mb i am getting connection reset error..any help??

 <httpRuntime maxRequestLength="2097151" executionTimeout="1200" />
dipa ahuja replied to mani on 13-Feb-12 02:52 AM
By default, the maximum size of a file to be uploaded to a server using the ASP.NET FileUpload control is 4MB. You cannot upload anything that is larger than this limit.
To change this size limit, you have to make some changes in the application's web.config:
  <httpRuntime  maxRequestLength="102400" executionTimeout="360"/>
maxRequestLength - Attribute limits the file upload size for ASP.NET application. This limit can be used to prevent denial of service attacks (DOS) caused by users posting large files to the server. The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET Framework 1.0/1.1 and "2097151" (2 GB) for .NET Framework 2.0.
executionTimeout - Attribute indicates the maximum number of seconds that a request is allowed to execute before being automatically shut down by the application. The executionTimeout value should always be longer than the amount of time that the upload process can take.
Web Star replied to mani on 13-Feb-12 03:22 AM

If you are using IIS7 than that problem happen and there's more thing to worry about. IIS7 has a built-in request scanning which imposes an upload file cap which defaults to 30MB. Again, this is a good feature, but it gets in the way if you're looking to upload files larger than 30MB.

appcmd set config "My Site/MyApp" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600 -commitpath:apphost

See this link for more datails about large file upload 
kalpana aparnathi replied to mani on 13-Feb-12 03:44 AM

If you're using ASP .NET, then you need to modify the maxRequestLength web.config property.

<httpRuntime executionTimeout="54000" maxRequestLength="512000" />

where execution timeout is in seconds, and maxRequestLength is in KB. executionTimeout, is basically the amount of time a thread will continue to run, and accept data by IIS/.NET. maxRequestLength, is the total amount of data that can be sent through HTTP Post to the server. The default is 4MB (4096)...and is generally set low so that your server will not be overwhelmed by possible DoS attacks.