Problem with uploading large datasets to a server. Try the solution problem

The maxRequestLength poses a problem when we upload large datasets or a file to a server.

Most of us have used the FileUpload control to upload files to the server. Little do we know that there is a limit to the file size that can be uploaded by this control by default. The default maximum size of the file that you can upload is of size 4096 KB (4 MB) .  

And moreover, the error that you get when the file being tried to upload is above this limit , is least useful in analyzing the problem. You may get one of these errors:

The page cannot be displayed.

Server Application is Unavailable

Exception of type System.OutOfMemoryException was thrown.

A quick turnaround for this problem is to alter the maxRequestLength Parameter of the <httpRuntime> Section, which holds the maximum size of the file that can be uploaded in KB’s,  in the Web.Config file.

Default: 4MB

<httpRuntime

            executionTimeout="110"

 maxRequestLength="4096" />

Solution: This is an example Only. Please modify to your needs (40 MB)

<httpRuntime

            executionTimeout="180"

            maxRequestLength="40960" />

By default the [maxRequestLength] attribute is set to 4096 KB, change this value to increase the size of the files that you want to upload to the server. 

Another setting involved in the size limitation of files to be uploaded is the value given to the [executionTimeout] attribute in the <httpRuntime> node itself.  The value given the  [executionTimeout] attribute is the number of seconds the upload is allowed to occur before being shut down by ASP.NET. Increase this value also to permit bigger file  uploads.

By [)ia6l0 iii   Popularity  (1905 Views)