Wednesday, May 23, 2012

maxAllowedContentLength in IIS 7.5

One week ago I have installed a new IIS 7.5 platform and shared a few folders using Webdav. Quickly I discovered that IIS 7.5 is configured to limit uploads and downloads via HTTP to files smaller than 30000000 bytes.

The error I was getting was: 'HTTP Error 404.13 - Not Found : The request filtering module is configured to deny a request that exceeds the request content length'. This is how IIS works by design but it doesn't fit my needs.

To get around this limitation I modified the Web.config file situated under c:\inetpub\webdavroot (it might probably be in different path on your server) and I added the following line:

<requestLimits maxAllowedContentLength="4294967290" />

Setting maxAllowedContentLength to 4294967290 will allow file transfers over http up to 4 gigabytes per file, which should be an acceptable value for a web service.

If your Web.config file does not already have the node, you must add it in the proper place in the section hierarchy. For instance today my Web.config file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="web_users" roles="" />
<requestLimits maxAllowedContentLength="4294967290" />
<directoryBrowse enabled="true" />

I hope this post helped you. If so, please do not hesitate to share.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...