I have come across this error multiple times at work. This problem occurs because the default value for the maxRequestLength parameter in the section of the Machine.config or Web.Config file is 4096 (4 megabytes). As a result, files that are larger than this value are not uploaded by default.

To resolve this problem, use one of the following methods:

  • In the Machine.config file, change the maxRequestLength attribute of the <httpRuntime> configuration section to a larger value. This change affects the whole computer.
  • In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 1 GB to be uploaded:
                         <httpRuntime maxRequestLength="1048576" />

Max value for maxRequestLength attribute is "1048576" (1 GB) for .NET Framework 1.0 or 1.1 and "2097151" (2 GB) for .NET Framework 2.0.

Note: During the upload process of large files, built-in ASP.NET loads the whole file in memory before the user can save the file to the disk. Therefore, the process may recycle because of the memoryLimit attribute of the processModel tag in the Machine.config file. More info you can find in Microsoft KB article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626

Signature

Comments

5/3/2007 7:21:42 PM #

Vaughan Chetwynd

Excellent article...... solved my upload problem immediately.
Thank you.

Vaughan Chetwynd New Zealand

5/10/2007 1:09:43 PM #

lol

lol

lol United Kingdom

5/31/2008 5:45:56 AM #

Shahaji Nangare (Senior System Analyst)

My problem is Maximum request length exceeded. It is solved immediately. Thanks.

Shahaji Nangare (Senior System Analyst) India

7/7/2008 6:39:24 AM #

Isaac Zothanpuia

Thanks a lot.....

Isaac Zothanpuia India

9/8/2008 9:33:00 AM #

Thiyagu

Really it's very helpfull articile

Thiyagu India

10/27/2008 9:30:09 AM #

thanks

Thank you!  This solved my problem immediately!

thanks United States

11/24/2008 11:42:58 AM #

Mark

I was getting this error when attempting to display and handle a large amount of data on the page. Simply changing the maxRequestLength did not fix the problem, but rather modifying the other attributes of httpRuntime in conjunction with maxRequestLength corrected the issue.

maxRequestLength="2097151"
executionTimeout="12000"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
/>

Reference: msdn.microsoft.com/en-us/library/e1f13641.aspx

Mark United States

3/12/2009 12:54:17 AM #

Arseny

Thanks. This article is still actual.

Arseny United Kingdom

7/13/2009 6:03:54 PM #

saravana perumal c

I am using IIS7. It gives error when I added "maxRequestLength" in the web.config file. Whehter this settings still exists?

saravana perumal c India

7/14/2009 12:34:20 AM #

Vishwa

Please make sure that you are adding it in correct section of web.config and IIS has correct .NET Framework selected for your app.

Vishwa United States

7/28/2009 3:03:48 PM #

Wilson

Thanks guys. This thread helps me to resolve the problem faced.

Wilson Malaysia

8/9/2009 9:35:11 AM #

Kjoplin

This fixed my 'Maximum Length Exceeded' type error as well. Thanks a bunch Smile

Kjoplin United States

8/13/2009 3:24:19 AM #

wibizone

Thats very helpfull. Thanks a lot

wibizone Indonesia

8/13/2009 4:30:56 AM #

San Diego Foreclosure

You made me late for work reading this. Nice blog, just bookmarked it for later reference.

San Diego Foreclosure United States

10/13/2009 10:38:55 AM #

Sue

Thank you for this article.  I really appreciate it.  I also appreciate the fact that you got straight to the point!  Thanks.

Sue United States

12/12/2009 9:30:04 AM #

Edward

Thank you. You saved my day.

Edward Hong Kong S.A.R.

2/9/2010 8:30:25 AM #

Prashanth M

Hello,

You saved my day with this resolution. It solved my issue instantly after modifying the web.config file.

Thanks a lot for this help.

Prashanth M India

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



About Me

Me Hello,my name is Vishwa Mohan Kumar.
I am a Software Architect. This blog is result of my experiments.

Flickr Photos

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent Comments

Comment RSS

Live Traffic Feed