Skip to content

Timeout when uploading a file

gnarly

Asked Dec 4, 2008, 9:39 AM EST3 answers
Share
LinkedInX

I'm uploading a file with 100,000 records with an asp:FileUpload control.  The processing per record is pretty intense with a few DB calls per line.  The problem I have is my process times out after about 20,000 records.  However, I can get it to run all the way through when I'm debugging.  Does anyone have any suggetions?  Let me know if you need more info. 

Also, why will it run without disruption in debugging mode?

Thanks.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    Is it generated any run time error?
    Lets try one thing: before build the project
    go to "Debug" option in visual studio->Exceptions->Managed Debugging Assistants->do "unchecked" ContextSwitchDeadlock.
    +1
  • +1

    There are no runtime errors and I made the configuration switch, but it still runs with no problems while debugging and errors out while not debugging.  >.<

    +1
  • +1

    FYI - the Server.ScriptTimeout default value is 90 seconds.  When you are debugging it is set to ~30,000,000 seconds (~350 days) so your page doesn't timeout.  Overkill, right?

    Anyway, I added an override on the Application_BeginRequest in the global.asax file of my web app and set the Server.ScriptTimeout value higher on the page that would handle the upload request.

    <script language="C#" runat="server">
    void Application_BeginRequest(object source, EventArgs e)
    {
       if (Request.Path.ToUpper().Equals("/page.aspx"))
          Server.ScriptTimeout = 7200; //2 hours
    }
    </script>
    +1