Upload File Size in IIS 7+
Today, i was programming to upload document files. When i wanted to upload a file having file size around 31mb, following error popped up:
To avoid this error, i had applied some changes in web.config file. By default, IIS7 limits file upload to 30MB. If the file size, you want to upload is larger than 30MB, it returns a 404 error. 30MB limit is set in IIS7, so we can change this limit.
To change the value in IIS 7+, do the following steps:
- Open IIS
- Select Requests Filtering and open it by double clicking the icon.
- Click on ‘Edit Request Filtering Services’ and below popup window will open. The default value of 30 MB (30000000) is shown.
There is an alternate solution that can be enabled at the site level rather than server-wide. As shown below, i have increased the content lenth from 30 MB to 50 MB in web.config's <system.webServer>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="524288000"/>
</requestFiltering>
</security>
</system.webServer>
<requestFiltering>
<requestLimits maxAllowedContentLength="524288000"/>
</requestFiltering>
</security>
</system.webServer>
Note that the maxAllowedContentLength is in BYTES.
If user try to upload the maximum allowed limit then 404.13 error display, as show in below screen.
To avoid such message from the server, we usually want to display some friendly message to the user. To do so, we have to apply some configuration setting in we.config file, as shown below.
<remove statusCode="404" subStatusCode="13" />
<error statusCode="404" subStatusCode="13" prefixLanguageFilePath="" path="UploadFile.aspx?e=FileSizeExceed" responseMode="Redirect" />
</httpErrors>
For more details about <httpErrors>;
http://msdn.microsoft.com/en-us/library/ms689487(v=vs.90).aspx
http://www.iis.net/configreference/system.webserver/httperrors/error
mapascar_za Shelly Carfindergirl https://wakelet.com/wake/Z7O_jEj_STKDm29wiG1sS
ReplyDeleteusscounhardchest
criminpros-chi_Las Vegas Darrell Orlando AVG PC TuneUp
ReplyDeleteWebsite
FonePaw
chihojehot