Home > Exchange 2007 > Max Message Size Increase: OWA, IMAP, EWS (maxRequestLength and maxAllowedContentLength)

Max Message Size Increase: OWA, IMAP, EWS (maxRequestLength and maxAllowedContentLength)

I have retrieved this info from the following URL.

By Default, the maximum message sizes for Exchange 2007 related services are as follows:

OWA: 30 MB (OWA directory)
IMAP\POP: 13 MB (EWS Directory)
ActiveSync: 10 MB (Sync Directory)

These settings are controlled by several factors: The maxRequestLength value within the web.config file for each IIS virtual directory and the maxAllowedContentLength value which is stored within IIS’ settings. (Metadata I presume).  The last attribute is for Windows 2008 and IIS 7 only.

We altered the default settings to accommodate for Entourage 2008 usage.  Here is what we know Entourage and its integration with Microsoft Exchange:

  • Entourage file attachment limitations are managed by the Exchange 2007 server in the EWS folder (IMAP\POP).
  • Assuming that when you don’t impose an attachment size limitation on a user– presumably because you don’t want there to be a limitation on their attachment sizes– is enough won’t work. Exchange applies its default limitation of 5mb!
  • Entourage applies overhead when converting files from MAC land to Windows.  Allow for 30% overhead when defining message attachments.
  • If you want to change the settings for OWA, IMAP, and ActiveSync, edit the web.config file for each of these directories…
    In my example, we changed all values to 50 MB.
    Edited the web.config entry–> <httpRuntime maxRequestLength=”50000” /> Please note this value is in Kilobytes (KB).
    Edited the web.config entry–><requestLimits maxAllowedContentLength=”52000000 /> Please note this value is in bytes (B).

    C:\Program Files\Microsoft\Exchange Server\ClientAccess\Owa
    C:\Program Files\Microsoft\Exchange Server\ClientAccess\exchweb\ews
    C:\Program Files\Microsoft\Exchange Server\ClientAccess\Sync

    If you are running Windows 2008 and IIS 7, you must also change the maxAllowedContentLength value.

    You must do this from a command window in the c:\windows\system32\inetsrv directory.  (Location of the appcmd.exe file)

    appcmd set config “Default Web Site/ews” -section:requestFiltering -requestLimits.maxAllowedContentLength:50000000
    appcmd set config “Default Web Site/owa” -section:requestFiltering -requestLimits.maxAllowedContentLength:50000000
    appcmd set config “Default Web Site/Microsoft-Server-Activesync” -section:requestFiltering -requestLimits.maxAllowedContentLength:50000000

    Please note, these values are required in bytes and not KB.  If these values do not equal the maxRequestLength value (50,000 KB versus 5,000,000 bytes), you will receive 404 File not found errors.

    You must reboot the server for the settings to take full effect.

    Also note, if you apply Exchange 2007 SP2, after making these changes, you will have to re-apply as the SP2 install clears the settings.

Article Update: In Exchange 2010 and Exchange 2010 SP1, you should no longer have to adjust these settings for ActiveSync or EWS.  Microsoft has set the defaults to 2 GB.  Outlook Web App is set to 35 MB, which you can also adjust.   Microsoft’s stance has changed as they now rely on the message transport settings on the Edge and HUB servers to control the max message limits.

If you are Exchange 2010 follow these steps:

You need to be assigned permissions before you can perform this procedure. To see what permissions you need, see the “Text editor” entry in the Client Access Permissions topic.

  1. Find the Outlook Web App Web.config file on the Client Access server. The default location is <drive>\Program Files\Microsoft\Exchange Server\V14\ClientAccess\Owa.
  2. Make a backup copy of the web.config file.
  3. Open the original file using an editor such as Notepad. Don’t use Internet Information Services (IIS) Manager to edit the Web.config file.
  4. Find maxRequestLength and change it to the value that you want. The value is stored in kilobytes (KB). The default value is 35000. The following example shows the maxRequestLength value in the Web.config file.
    <httpRuntime maxRequestLength=”51200” />

Note: This is 50 MB (1024 X 50)

  1. Find maxAllowedContentLength      and change it to the value that you want. The value is stored in bytes      (B). The default value is 35000000. The following example shows the maxRequestLength value in the      Web.config file.
    <requestLimits maxAllowedContentLength=”51200000”      />

Note: This is 50 MB (1024 X 50)

  1. Save and close the file.
  2. Reset IIS

Cheers!

Categories: Exchange 2007
  1. Luke
    November 3, 2010 at 4:49 AM

    Strangely my EWS web.config does not have a section where I can change the maxrequestlength. I could add one, but have absolutely no idea where to start.

    • November 3, 2010 at 1:15 PM

      The file should be there if you have IIS installed. Do a search on your c:\ drive for web.config. Be sure you are showing hidden files and folder, just in case.

      Ed McKinzie

      • AS
        November 10, 2010 at 5:15 PM

        Hi Ed – I think he means that there is no existing entry for <httpRuntime maxRequestLength in his web.config file, which is the same issue that bought me here.

        I've made this change before on Win2k3 servers just fine but on this Win2k8 server with Ex2007, I don't see an existing property at all.

      • AS
        November 10, 2010 at 5:22 PM

        To clarify, I do see the property in the owa vdir web.config file, but *not* in the EWS vdir web.config file

    • February 15, 2012 at 7:42 AM

      It doesn’t show up because you need Service Pack 3 on your Exchange. I had the same issue.

  2. November 15, 2010 at 11:50 AM

    The attribute is for Windows 2008 and IIS7 only. What server version are you running?

    Ed McKinzie

  3. ZUber
    September 7, 2011 at 7:21 AM

    Sorry to have opened this up but did anyone find a solution to this.

    I have the same problem as LUKE and AS, I have all the web.config files but the web.config under the EWS folder does not contain a maxrequestlenght.

    Can anyone help?

    Thanks in advance

  4. Zuber
    September 7, 2011 at 8:25 AM

    I have managed to solve this issue now. Well its working for me right now.

    You need to add the string (the 30000 can be any value in KB) to the web.config file in the EWS folder. it needs to be added before the line

    so it looks like this:

    also make sure the requestlenght is same in all of the web.config file.

    • Diogo
      July 25, 2014 at 5:33 AM

      Hi Zuber, which line are you talking about, i am dealing with the same issue and I dont know where should i add the line <requestLimits maxAllowedContentLength=”51200000”.

  5. July 6, 2012 at 6:55 AM

    We are running IIS 6 on windows server 2003 – and the string is not in the web.config file – should we add it or is it somewhere else ?

    (and appcmd.exe is not on iss 6)

    • July 7, 2012 at 11:36 AM

      These settings only apply to Exchange 2007\2010 on Windows 2008\R2

  6. Kevin A.
    December 12, 2013 at 7:57 AM

    Ed, thanks for the excellent information!

    If you have multiple exchange sites behind your CAS server do these settings need to be adjusted on those servers too?

    I have a distributed 2007 environment.

    Thanks,
    K

  7. Kris
    August 21, 2014 at 5:05 AM

    Hi Ed,

    Would you mind showing me how this can be done on a mac for outlook 2011?

  1. June 29, 2011 at 5:54 AM
  2. August 31, 2012 at 7:27 AM
  3. November 12, 2014 at 8:21 PM
  4. November 13, 2014 at 1:39 AM

Leave a comment