Images or files uploaded in. NET projects are too large to upload

Source: Internet
Author: User

Recent projects when the user proposed to upload a large picture of a picture there may be more than 10 trillion originally used by the third-party upload control has limited the image upload size settings

Previously set is 2M according to the user's requirements to directly limit the upload size of the image settings to change it can be, but when uploading a large picture is always an exception:

Error message: The maximum request length has been exceeded

Solution:

Error reason: The ASP. NET default maximum upload file size is 4M and the run time-out is 90S.

Modify the configuration in Web. config

  <configuration>               <system.web>              

After this modification in my project, it's no problem to upload it. Simply explain:

Executiontimeout execution Time-out: units are seconds
maxRequestLength upload Maximum length: Above I have set the maximum value of the unit is  kb

PS: The following is the complete configuration of the httpruntime and related explanations

  <executiontimeout= "  maxrequestlength"= "951200"     useFullyQualifiedRedirectUrl= "true"  minfreethreads= "8"     minLocalRequestFreeThreads= "4"  apprequestqueuelimit= "   Enableversionheader= "true"/>

HttpRuntime is to configure the ASP. NET HTTP run settings to determine how to handle requests to an ASP.

Executiontimeout: Represents the maximum time limit allowed to execute a request, in seconds

maxRequestLength: Indicates the maximum file upload size supported by ASP. This display can be used to prevent denial of service attacks that result from the user passing a large number of files to the server. The specified size is in kilobytes. The default value is 4096KB.

Userfullyqualifiedredirecturl: Indicates whether client redirection is fully qualified (in "Http://server/path" format, which is required for some mobile controls), or indicates whether to send relative redirects to the client instead. If true, all redirects that are not fully qualified are automatically converted to the fully qualified format. False is the default option.

minFreeThreads: Specifies the minimum number of free threads that are allowed to execute new requests. Asp. NET maintains a free state for the specified number of threads that require additional threads to complete their processing requests. The default value is 8.

minLocalRequestFreeThreads: Represents the minimum number of free threads that ASP. NET remains allowed to perform new local requests. The number of threads is reserved for incoming requests from the local host, in case some requests make child requests to the local host during their processing. This avoids deadlocks that may result from recursive re-entry to the Web server.

Enableversionheader: Indicates whether the specified ASP. NET should output a version of the header. The VS2005 uses this property to determine the current version of ASP. For a production environment, this property is not required and can be disabled.

Images or files uploaded in. NET projects are too large to upload

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.