When I was working on a project recently, the user proposed to upload a large picture. One image may be more than ten million. I used a third-party upload control. There are settings that limit the size of the image upload.
The previous setting was 2M. According to the user's requirements, I thought it would be enough to directly change the settings that limit the upload size of the picture. However, when uploading large pictures,
Always exception:
Error message: Maximum request length exceeded
Solution:
Cause of error: The default maximum upload file size is 4M, and the running timeout is 90S.
Modifying configuration
<configuration> <> <httpRuntime useFullyQualifiedRedirectUrl="true" executionTimeout="120" maxRequestLength="2097151"/> </> <configuration>
This modification in my project will be uploaded afterwards. Let’s briefly explain:
executionTimeout execution timeout: unit is seconds
maxRequestLength upload maximum length: What I set above is already the largest value, the unit is KB
ps: The following is the complete configuration of httpRuntime and the related explanations
<httpRuntime executionTimeout="600" maxRequestLength="951200" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true"/>
httpRuntime is to configure http run settings to determine how to handle requests to the application.
executionTimeout: indicates the maximum time limit for allowing execution of requests, in seconds
maxRequestLength: Indicates the maximum file upload size supported. This display can be used to prevent denial of service attacks caused by a user passing a large number of files to the server. The specified size is in KB. The default value is 4096KB.
userFullyQualifiedRedirectUrl: indicates whether the client redirection is fully qualified (in the format "http://server/path", which is required for some mobile controls), or indicates whether to send the relative redirection to the client instead. If true, all redirects that are not fully qualified will be automatically converted to fully qualified formats. false is the default option.
minFreeThreads: Indicates the minimum number of free threads that specify the allowed new requests to be executed. A specified number of threads remains free in order to require additional threads to complete their processing requests. The default value is 8.
minLocalRequestFreeThreads: Indicates the minimum number of free threads that are maintained that are allowed to execute new local requests. The number of threads is reserved for requests incoming by the localhost in case some requests issue subrequests to the localhost during their processing. This avoids deadlocks that may be caused by recursive reentering to the web server.
enableVersionHeader: Indicates whether the specified version of the header should be output. vs2005 uses this property to determine the current usage version. For production environments, this property is not required and can be disabled.
The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!