Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that pictures or files uploaded in a .net project are too large to be uploaded?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

How to solve the problem that the pictures or files uploaded in the .net project are too large to upload. In view of this problem, this article introduces the corresponding analysis and solutions in detail. I hope it can help more partners who want to solve this problem to find a simpler and easier way.

Recently, when I was working on a project, the user proposed to upload a large picture, maybe more than ten megabytes of the third-party upload control has a setting to limit the upload size of the picture.

The previous setting is 2m, according to the request of the user, we can just change the setting that limits the upload size of the image directly, but when uploading a large picture,

Always abnormal:

Error message: maximum request length exceeded

Solution:

Cause of error: by default, the maximum upload file size of asp.net is 4m, and the run timeout is 90s.

Modify the configuration in web.config

It will be no problem to upload after this modification in my project. Let's simply explain:

ExecutionTimeout execution timeout: in seconds

Maximum length of maxRequestLength upload: the value I set above is already the largest. Unit is KB.

Ps: here is the complete configuration of httpRuntime and related explanations

HttpRuntime is to configure the asp.net http run settings to determine how to handle requests to the asp.net application.

ExecutionTimeout: indicates the maximum time limit allowed to execute the request (in seconds)

MaxRequestLength: indicates the maximum file upload size supported by asp.net. This display can be used to prevent a denial of service attack caused by a user passing a large number of files to the server. The specified size is in KB units. The default value is 4096KB.

UserFullyQualifiedRedirectUrl: indicates whether the client redirection is fully qualified (in http://server/path" format, which is required by some mobile controls), or whether to send the relative redirection to the client instead. If true, all redirects that are not fully qualified are automatically converted to a 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 keeps the specified number of threads free in order to require additional threads to complete their processing of requests. The default value is 8.

MinLocalRequestFreeThreads: represents the minimum number of free threads maintained by ASP.NET that are allowed to execute new local requests. The number of threads is reserved for incoming requests from the local host in case some requests make subrequests to the local host during their processing. This avoids deadlocks that may result from recursive re-entry into the web server.

EnableVersionHeader: indicates whether the specified ASP.NET should output a version of the header. Vs2005 uses this attribute to determine which ASP.NET version is currently being used. For production environments, this property is not required and can be disabled.

This is the answer to the question about how to solve the problem that the pictures or files uploaded in the .net project are too large to be uploaded. I hope the above content can be of some help to you, if you still have a lot of doubts to be solved. You can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report