Solve the problem that images or files uploaded in the. net project are too large to be uploaded. net upload

Source: Internet
Author: User

Solve the problem that images or files uploaded in the. net project are too large to be uploaded. net upload

Recently, when I was working on a project, the user proposed to upload a large image. A picture may have dozens of megabytes. The third-party upload control used to set the size of the image to be uploaded.

In the past, we set 2 M to directly change the size limit for uploading images according to the user's requirements. However, when uploading large images

Always exception:

Error message: exceeds the maximum Request Length

Solution:

Error cause: By default, asp.net has a maximum file size of 4 MB and a running timeout value of 90 S.

Modify the configuration in web. config

<configuration>    <system.web>   

After this modification is made in my project, it is okay to upload it again. A simple explanation is as follows:

ExecutionTimeout execution timeout time: in seconds

MaxRequestLength the maximum length of the upload: I have set the maximum value above. The unit is KB.

Ps: the complete httpRuntime configuration and Related explanations are as follows:

 

HttpRuntime is used to configure the asp.net http runtime settings to determine how to process requests to the asp.net application.

ExecutionTimeout: maximum time limit allowed for request execution, in seconds

MaxRequestLength: indicates the maximum file upload size supported by asp.net. This display can be used to prevent DoS attacks caused by a large number of files being transferred to the server. The specified size is KB. The default value is 4096KB.

UserFullyQualifiedRedirectUrl: indicates whether the client redirection is fully qualified (in the format of "http: // server/path", which is required by some mobile controls ), or indicates whether to send relative redirection to the client. If it is true, all non-fully-qualified redirects are automatically converted to a fully-qualified format. False is the default option.

MinFreeThreads: specifies the minimum number of free threads allowed to execute new requests. ASP. NET requires additional threads to process requests while a specified number of threads remain free. The default value is 8.

MinLocalRequestFreeThreads: the minimum number of free threads allowed to execute new local requests maintained by ASP. NET. The number of threads is reserved for requests passed in by the local host to prevent some requests from sending subrequests to the local host during processing. This avoids deadlocks that may result from recursive re-access to the web server.

EnableVersionHeader: indicates whether the specified ASP. NET version header should be output. Vs2005 uses this attribute to determine the current ASP. NET version. This attribute is not required for the production environment and can be disabled.

The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!

Related Article

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.