Uploading file failed: Request does not contain any files

3
In one of our applications we're trying to upload a large file. The result is an exception in the log: Uploading file failed: Request does not contain any files The application is hosted on a Windows 2008R2 server and IIS 7.5 webserver.
asked
1 answers
6

Microsoft introduced a new configuration option that can cause an issue when uploading files (or webservice messages) larger than 28,61 mb. This only occurs for IIS 7.x on windows 2008 (I think R2 but might apply to R1 as well). This does not apply for any older IIS / windows combinations.

Since windows 2008 R2 & IIS 7.0 a new feature has been introduced, this feature includes the following parameters: maxAllowedContentLength & maxRequestLength. This feature allows you configure limits on all requests passing through IIS, in this case the maximum allowed content length. Any message received from or send to the platform needs to be less than the specified size. When a user uploads a file, the browser/client generates a request with the same size as your file + some overhead. This can easily become a problem since the default value of this property is “30 000 000” bytes (+/-28.61mb), if you want to upload files larger than 28mb you need to add the following configuration to your web.config file.

<system.web>
    <httpRuntime maxRequestLength="[yourSizeInBytes]" />
</system.web>
<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="[yourSizeInBytes]" />
        </requestFiltering>
    </security>
</system.webServer>

If you exceed any of the configured limits (there are more, but they don’t seem relevant), than IIS will return a 404.1x fault message but neither the client nor the platform understand that new error code so you won’t receive a usable error message.

answered