Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Handling maxRequestLength errors in IIS6

Handling maxRequestLength errors in IIS6

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestioncsharpasp-net
6 Posts 3 Posters 20 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Radoslav Bielik
    wrote on last edited by
    #1

    Hi there, I'm facing a problem with limiting the file upload size in ASP.NET 2.0, or more specifically, by handling "file too large" errors. I did the development & testing on a Vista Business / IIS 7, where I was able to handle the situation nicely using the Application_Error handler in global.asax. When the uploaded file size is larger than maxRequestLength, I just displayed a friendly error page with explanation. After deploying the application to the production server, which is running Windows 2003 R2 with IIS 6, I realized that this doesn't work. What's worse, in case the file is larger than the limit, it won't display any error message, IIS simply cuts off the connection and browsers display their own error message about the network connection being interrupted. Is there any solution to this problem on IIS 6? All my googling points to websites suggesting the Application_Error handler, or eventually configuring a custom error page in IIS directly, but none of this will work if IIS 6 just cuts off the connection. Also, it does this right in the beginning - i.e. I try to upload a 4MB file and it cuts me off after 5 seconds, not after transferring 2MB (which is my current limit, note that the server is remote and I have 256kbit upload) so it must know about the filesize from the start. I'd like to be able to handle this in a friendlier matter, in a simple way (i.e. handling in .NET code, or by configuring error page in IIS). I know that there are flash uploaders, etc, but those are out of question right now. Any clues or ideas are highly appreciated! Thanks, Rado

    A R 2 Replies Last reply
    0
    • R Radoslav Bielik

      Hi there, I'm facing a problem with limiting the file upload size in ASP.NET 2.0, or more specifically, by handling "file too large" errors. I did the development & testing on a Vista Business / IIS 7, where I was able to handle the situation nicely using the Application_Error handler in global.asax. When the uploaded file size is larger than maxRequestLength, I just displayed a friendly error page with explanation. After deploying the application to the production server, which is running Windows 2003 R2 with IIS 6, I realized that this doesn't work. What's worse, in case the file is larger than the limit, it won't display any error message, IIS simply cuts off the connection and browsers display their own error message about the network connection being interrupted. Is there any solution to this problem on IIS 6? All my googling points to websites suggesting the Application_Error handler, or eventually configuring a custom error page in IIS directly, but none of this will work if IIS 6 just cuts off the connection. Also, it does this right in the beginning - i.e. I try to upload a 4MB file and it cuts me off after 5 seconds, not after transferring 2MB (which is my current limit, note that the server is remote and I have 256kbit upload) so it must know about the filesize from the start. I'd like to be able to handle this in a friendlier matter, in a simple way (i.e. handling in .NET code, or by configuring error page in IIS). I know that there are flash uploaders, etc, but those are out of question right now. Any clues or ideas are highly appreciated! Thanks, Rado

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Did you set the values in web.config for upload ?

      cheers, Abhijit My Recent Article : Beginner's Guide To ASP.Net Cookies

      R 1 Reply Last reply
      0
      • A Abhijit Jana

        Did you set the values in web.config for upload ?

        cheers, Abhijit My Recent Article : Beginner's Guide To ASP.Net Cookies

        R Offline
        R Offline
        Radoslav Bielik
        wrote on last edited by
        #3

        But of course - as I said in my original post all works well on IIS 7. The maxRequestLength is set to 2048 (2MB) and executionTimeout to 2 minutes. Thanks!

        1 Reply Last reply
        0
        • R Radoslav Bielik

          Hi there, I'm facing a problem with limiting the file upload size in ASP.NET 2.0, or more specifically, by handling "file too large" errors. I did the development & testing on a Vista Business / IIS 7, where I was able to handle the situation nicely using the Application_Error handler in global.asax. When the uploaded file size is larger than maxRequestLength, I just displayed a friendly error page with explanation. After deploying the application to the production server, which is running Windows 2003 R2 with IIS 6, I realized that this doesn't work. What's worse, in case the file is larger than the limit, it won't display any error message, IIS simply cuts off the connection and browsers display their own error message about the network connection being interrupted. Is there any solution to this problem on IIS 6? All my googling points to websites suggesting the Application_Error handler, or eventually configuring a custom error page in IIS directly, but none of this will work if IIS 6 just cuts off the connection. Also, it does this right in the beginning - i.e. I try to upload a 4MB file and it cuts me off after 5 seconds, not after transferring 2MB (which is my current limit, note that the server is remote and I have 256kbit upload) so it must know about the filesize from the start. I'd like to be able to handle this in a friendlier matter, in a simple way (i.e. handling in .NET code, or by configuring error page in IIS). I know that there are flash uploaders, etc, but those are out of question right now. Any clues or ideas are highly appreciated! Thanks, Rado

          R Offline
          R Offline
          Rajdev Ramasamy
          wrote on last edited by
          #4

          Hi, please try to extend the maxrequestlength in web.config to 5MB or greater, you can extend upto 2 GB for a 2.0 application. Please revert back if the problem still exists. Thanks, Rajdev

          R 1 Reply Last reply
          0
          • R Rajdev Ramasamy

            Hi, please try to extend the maxrequestlength in web.config to 5MB or greater, you can extend upto 2 GB for a 2.0 application. Please revert back if the problem still exists. Thanks, Rajdev

            R Offline
            R Offline
            Radoslav Bielik
            wrote on last edited by
            #5

            Thanks, but actually, I need to limit file upload size (and handle it in a friendly manner) that's why I set this to 2MB so this would not resolve anything. Btw I did not find any solution to this - it seems to me that it's not possible to handle this in IIS6, whereas it works nicely in IIS7.

            R 1 Reply Last reply
            0
            • R Radoslav Bielik

              Thanks, but actually, I need to limit file upload size (and handle it in a friendly manner) that's why I set this to 2MB so this would not resolve anything. Btw I did not find any solution to this - it seems to me that it's not possible to handle this in IIS6, whereas it works nicely in IIS7.

              R Offline
              R Offline
              Rajdev Ramasamy
              wrote on last edited by
              #6

              Hi, We have faced a similar issue and resolved it. Please find the instructions we followed to resolve. We have limited the upload size to 10MB and we are showing friendly message if the size exceeds. Please revert back if you still have the issue.Thanks. Root Cause of the Issue · IIS6 uses a new metabase property called UploadReadAheadSize when passing data to an ISAPI extension. This property is used to determine the maximum buffer size for the incoming request. The default size for this buffer is 48k · If UploadReadAheadSize is smaller than the content length, an HTTP 413error is returned, and the connection is closed to prevent deadlock. This causes the “Page cannot be displayed” error in IE Solution · Change the value of UploadReadAheadSize to a value larger than the content length · The following example shows how to set the value for UploadReadAheadSize to 200KB on the Web server cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 200 Source http://technet.microsoft.com/en-us/library/cc737382.aspx http://blogs.msdn.com/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx Thanks, Rajdev

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups