digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Website and Server Troubleshooting (https://www.digitalfaq.com/forum/web-tech/)
-   -   HTTP Error 404.13 Not Found, Windows IIS 7 + maxAllowContentLength (https://www.digitalfaq.com/forum/web-tech/2873-http-error-404-a.html)

kpmedia 02-13-2011 08:34 PM

HTTP Error 404.13 Not Found, Windows IIS 7 + maxAllowContentLength
 
2 Attachment(s)
If you run a Windows 2008 IIS7 server, and decide to allow attachments from users, you'll run into problems past 30 MB unless you customize the server settings. By default, Windows IIS 7 will only allow a maximum of 30 megabytes of data to be uploaded via HTTP requests, by way of the maxAllowedContentLength filter.

End-users will get generic error messages, either "HTTP Error 404.13 - Not Found" or a plain/useless "HTTP Error 500" when trying to upload anything larger than 30MB. However, as any decent Windows admin knows, accessing the site from the server will reveal the full error log in a browser **. For example:

Attachment 1288

Quote:

Error Summary: The request filtering module is configured to deny a request that exceeds the request content length.
Module: RequestFiltertingModule
Notification: BeginRequest
Error Code: 0x00000000
Most likely causes: Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value.
Things you can try: Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowContentLength setting in the applicationhost.config or web.config file.
Unlike IIS6 and IIS5, the errors from IIS7 are actually slightly useful. Still slightly useless, but far better than it had been in past years. And this is one of the few situations were the "things you can try" is actually pretty close at giving you enough information to further research the problem. (Most times, the suggestions are politicianese -- words that mean nothing.)

You have three primary solutions:

(1) The maxAllowedContentLength filter can be disabled entirely, but that's a really bad idea.

(2) Alter the web.config for your application, which makes the bad assumption that your app is native to Windows and comes with a web.config that can be easily edited. For an ASP.NET app, I'm sure this is great. But when you're serving PHP or MySQL content, further complicated by panels such as Plesk, this becomes a guessing game on which app needs permissions, and/or where's the web.config. No thanks.

(3) The better solution is to increase the limit to something higher, just slightly above your max file size, system-wide. (For example, if you want to allow 32MB uploads, the set it to 36MB.) There's several ways to change the config file, either by clicking through the OS and opening the file in an editor, or by using several variations of DOS commands. This is what I suggest:

Start > Run > CMD to to go command prompt.
Go to your Windows directory, into the System32 folder, and then again into Inetsrv
Call it "slow" or a "waste of time", but I prefer to enter folders one by one. I always have, since the late 1980s. It's harder to screw something up when you're entering less data into the command prompt. For the impatient, you can enter this:
Code:

cd %windir%\system32\inetsrv\
Then you'll want to SLOWLY AND CAREFULLY enter this change syntax:
Code:

appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
You'll get this confirmation:

Attachment 1290

Note the number at the end. This is your new max size, in bytes. This example is 100MB (3 x 32MB uploads at one time)
104 857 600 bytes = 100 megabytes
104,857,600 = 100MB

Remember to account for language/database timeouts, when deciding on filesize. For example, a 30-second timeout is probably inadequate for a 32MB upload on most home/office broadband connections. You'll find 60-90 seconds is needed for a stable 32MB upload via HTTP.

Then there are also setting within PHP and MySQL, for example, via the my.ini and php.ini, which limit the max upload sizes. Further on, the actual software (vBulletin, for example) has its own internal max attachment settings. The smallest settings wins! So if you want a 32MB upload, you'll have to ensure all settings, all across the board, will allow for it.

** Notes on web browsers:
On a Windows 2008 webserver, I suggest Google Chrome or Firefox -- not Internet Explorer. That malware-allowing butcher job of a browser should NEVER be run on a server. Chrome is also much leaner, and will operate faster. For the security worriers, Firefox and Chromium both offer portable no-install editions that can be unzipped, used in a temp folder, and then deleted. Keep the zip, repeat as needed.

... and if you're looking for a reliable Windows host, be it dedicated or VPS, look no further than EuroVPS. For the past 5 years, EuroVPS has proven themselves to me to be one the best Windows hosts in the world. (Not in Europe? Not a problem. Their servers are peered directly to New York, and give excellent speeds all across North America. Don't pick your host based on geography -- pick your host because of server and service quality!) Windows is already a slight pain in the butt by itself -- you don't want a bad host to add to that stress.


All times are GMT -5. The time now is 03:24 AM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.