Uploading file size over 4 MB in .NET

2019-07-17 14:42发布

问题:

I am having trouble uploading a file size over 4 MB. I've tried adding

<httpRuntime maxRequestLength="102400" executionTimeout="99999" />

to my Web.Config like many posts have suggested, but it just isn't working. Files under 4 MB work just fine, so I'm nearly certain I'm running into the 4 MB limit. Are there any settings in IIS that I might need to change?

回答1:

You need to update the value of maxrequestlength in the web.config:

Maximum value of maxRequestLength?

Max Request Length



回答2:

You can use that code into your web.config file.

<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="102400000000" 
 appRequestQueueLimit="100000" requestValidationMode="4.0"
 requestLengthDiskThreshold="10024000000000"/>
</system.web>

I think it will work