Preventing browser timeout on large file uploads
Asked Answered
A

8

10

I have a nice little file upload control I wrote for ASP.NET webforms that utilizes an IFrame and ASP.NET AJAX.

However, on large uploads, the browser times out before it can finish posting the form.

Is there a way I can increase this?

I'm not really interesting in alternative solutions, so don't suggest changing the entire thing out please. It works good for <5 meg uploads, I'd just like to get it up to about 8mb.

EDIT: Setting the timeout in Page_Load didn't appear to change anything.

Alternate answered 21/10, 2008 at 22:22 Comment(0)
S
11

You need to update a metabase setting on IIS6 and later. The key is " AspMaxRequestEntityAllowed" and is expressed in bytes. I highly recommend the Metabase Explorer to make the change, wading through the XML at %systemroot%\system32\inetserv\metabase.xml is possible though.

Metabase Explorer: http://support.microsoft.com/kb/840671

Hmmm, perhaps I'm barking up the wrong tree... you wouldn't be doing 5 MB files if that wasn't already adjusted.

Another stab at it: see your web.config:

<system.web>
  <httpRuntime  maxRequestLength="10240" executionTimeout="360"/>
</system.web>

Max request length is in kilobytes and execution timeout is in seconds.

Sterling answered 23/10, 2008 at 18:37 Comment(2)
maxRequestLength is actually in kilobytes. See msdn.microsoft.com/en-us/library/e1f13641.aspxLeda
You are right otherwise the small number I mention wouldn't make sense. Thanks, edited.Sterling
E
4

Place this in your web.config

  <system.web>
     <httpRuntime executionTimeout="360" maxRequestLength="100000" />

That enables a 360 second timeout and 100,000 Kb of upload data at a time.

If that doesn't work, run this command on your IIS server. (replace [IISWebsitename])

C:\Windows\System32\inetsrv>appcmd set config "[IISWebsitename]" -section:requestFiltering -requestLimits.maxAllowedContentLength:100000000 -commitpath:apphost

That enables 100,000,000 bytes of upload data at a time.

Expostulatory answered 21/7, 2010 at 22:9 Comment(1)
Thanks! The requestFiltering parameter did the trick for me. In IIS 7, I made the change with the following command: Request Filtering | Rules | Edit Feature Settings | Maximum allowed content length.Limonite
S
2

In Page_Load, set Server.ScriptTimeout to a value that works for you. Measured in seconds I believe.

Saloma answered 21/10, 2008 at 22:30 Comment(2)
You would do this in the actual iframe that gets posted back, correct?Alternate
Yes, if you are getting the request timeout in the iframe, then that would where you set Server.ScriptTimeout.Saloma
D
1

I think you may need to adjust the MaxRequestLength

Its in the Web.config I think by default its 4megs.

The following would allow ~10 meg file:

<httpRuntime maxRequestLength="10240" />
Derma answered 23/10, 2008 at 18:43 Comment(0)
P
1

Open your Web.config file, and just below the <system.web> tag, add the following tag:

<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" />

Now, just take a look at the maxRequestLength="4096" attribute of the <httpRuntime> tag. As you may have realized, all you need to do is change the value to some other value of your choice (8192 for 8 Mb, 16384 for 16 Mb, 65536 for 64 Mb, and so on...).

Patriarchate answered 3/2, 2016 at 6:12 Comment(0)
E
0

Sometimes it's just adding more CPU capacity to the server. I'm using Azure, and I just needed to upgrade/scale from the Basic plan to the next level. I noticed the bug, by looking at the memory usage chart, which hit 100% of usage frequently.

Energid answered 7/6 at 15:11 Comment(0)
C
-7

Check the code of Velodoc XP Edition. It includes an upload streaming module, a resumable download handler and ASP.NET upload controls based on ASP.NET Ajax extensions and it is all open source.

For more information check also www.memba.com and www.velodoc.com.

Certainty answered 2/12, 2008 at 10:37 Comment(2)
This doesn't directly address the question, and it may be an advertisement.Dyche
Website linked to is not currently in use.Boutique
E
-7

I solved this using PHP with HTML:

  1. I start a session
  2. enter a loop
  3. create a loop that reloads the page that does part of the job at a time
  4. do until job is done
  5. the code inside the loop does a portion of the job
  6. increment a session variable to point to next part of the job
  7. reload the page using java script //this will restart the severs page timer
  8. loop
  9. load a page to report the job is done
Es answered 6/3, 2011 at 22:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.