How do I enable upload of large files in classic ASP on IIS 7?

后端 未结 6 2245
忘了有多久
忘了有多久 2020-11-30 03:01

Recently I had to get an old ASP application working in IIS 7.5 on a W2K8 server. Almost everything works fine, except that I can\'t seem to get it to accept uploads larger

6条回答
  •  甜味超标
    2020-11-30 03:53

    First off @AnthonyWJones answer was very helpful but didn't solve my problem, in fact it's slightly inaccurate and for that reason I'm writing this.

    Large uploads in IIS 6 was a doddle you had one configuration value to worry about

    AspMaxRequestEntityAllowed

    The AspMaxRequestEntityAllowed property specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of AspMaxRequestEntityAllowed, IIS returns a 403 error response. This property is related in function to MaxRequestEntityAllowed, but is specific to ASP request. Whereas you might set the MaxRequestEntityAllowed property to 1 MB at the general World Wide Web Publishing Service (WWW Service) level, you may choose to set AspMaxRequestEntityAllowed to a lower value, if you know that your specific ASP applications handle a smaller amount of data.


    With the introduction of IIS 7 and it's new hierarchical XML-based configuration system that uses *.config files it all got a bit more complicated.

    There are now two settings you need to configure correctly before Large File Uploading will work as you expect and they both live in different areas of the configuration.

    maxRequestEntityAllowed

     
       
         
           
         
       
     
    

    The maxRequestEntityAllowed attribute specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of maxRequestEntityAllowed, IIS returns an HTTP 403 error response.

    IMPORTANT: Configuring the above setting will work up to a point as you will see from the default below but once you reach that default regardless of what maxRequestEntityAllowed is set to, the server will respond with HTTP 404 Not Found error response. This confused me at first because I thought it must be my code that was returning the 404 error response.

    maxAllowedContentLength

     
       
         
           
             
           
         
       
     
    

    Specifies the maximum length of content in a request, in bytes. The default value is 30000000, which is approximately 28.6MB.

    This setting is extremely important as it defines the maximum number of bytes in an IIS Request (not an ASP Request like the previous configuration value) it has nothing to do with the content length of the response (as has previously been stated). Regardless of what maxRequestEntityAllowed (which is a asp-classic specific setting) is set to, if maxAllowedContentLength is not set or you try to upload more then the default of 28 MB (approx.) you will get a HTTP 404 error response.

    Links

    • ASP Limits

    • Request Limits

提交回复
热议问题