HTML5 File Upload-iis7 reports a strange 404 (notfound) Error

Source: Internet
Author: User
Document directory
  • Background
  • What is the problem?
  • Solution
  • References

Recently I encountered the most disgusting problem. I had no choice but to ask questions about Google. Later I used Chrome's development tool to carefully read the response information of the Web server to find out why...

Record it to see who has met it.

Background

A jquery HTML5 upload control was written earlier with reference to the http://code.google.com/p/html5uploader.

I encountered some disgusting problems when I tested it on an Asp.net mvc3 website yesterday:

1. When the file is small, it can be uploaded normally. (For example, 10 MB or so. I modified web. config,

2. Error 404 is reported when uploading a 45 mb psd file.

404 ah... The error is reported only when the web server cannot find the resource. How can this type of exception be thrown during file upload ??? The worst thing is that it is normal when the file is small.

 

Errors reported by Chrome console:

Failed to load resource: the server responded with a status of 404 (not found)

 

Chrome Network Monitoring default view:

View after clicking in

 

What is the problem?

When Chrome is used to view the server response information, the preceding two views are generally used...

Most users may ignore the "preview" and "response" tabs on the right .. I will only look at the basic information in headers. I know the problem is 404 not found, but I do not know the specific cause.

I ran to click "preview" and "reponse" for a day "!!!

In fact, the problem is the same as I expected at the beginning. It must be related to the server configuration. The IIS server has a default size limit on the file stream of HTTP requests.

However, according to the msdn document, I have changed maxrequestlength to a large enough value. Is there any other configuration item impact ??

For the "preview" tab

 

 

 

Solution

The above is clear enough,

1. in IIS, The maxrequestlength of the system. web section must be modified to a proper size. Unit: kb.

 

2. In the section "system. webserver", modify the maxallowedcontentlength in btye. For example, set the following configuration to 300 MB.

<! -- Maxallowedcontentlength, which affects the upload size. The default value of iis7 is 30000000 bytes, which is 30 mb. The following configuration is 300 mb. -->
<Security>
<Requestfiltering>
<Requestlimits maxallowedcontentlength = "300000000"> </requestlimits>
</Requestfiltering>
</Security>

 

 

Other notes:

During HTML5 Ajax upload, you must use the filereader provided by HTML5 to read files from the client. In Chrome, you can use the formdata object as the value of the send method parameter of the XMLHttpRequest instance. You can also use the window. btoa method to convert the file into a base64 encoded text stream and use it as the parameter value of the send method. If btoa is used, the actual number of bytes transmitted is larger than the size of the file itself.

 

References

1, iis7 needs both maxrequestlength and maxallowedcontentlength. Why?

Http://forums.asp.net/t/1637223.aspx/1

2, maxrequestlength and iis7

Http://forums.iis.net/p/1150009/1993988.aspx

 

 

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.