Changing Exchange Message Size Limits for EWS

This article shows how you can change the message size limits for EWS on a Exchange server. Example values adjust the limit to 100 MB

References

Changing global limits for transport, send and receive connectors



  1. Connect with PowerShell or open Exchange Management Shell (EMS) on the Exchange server

  2. Check the current message size limits by executing the following PowerShell commands:
    Get-TransportConfig | Format-List -Property MaxReceiveSize, MaxSendSize
    Get-SendConnector | Format-List -Property Identity, MaxMessageSize
    Get-ReceiveConnector | Format-List -Property Identity, MaxMessageSize

  3. Set new message size limit by executing the following commands:
    Set-TransportConfig -MaxReceiveSize 100MB -MaxSendSize 100MB
    Get-SendConnector | Set-SendConnector -MaxMessageSize 100MB
    Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize 100MB

Changing IIS limits

Change the value for maxAllowedContentLength. Please note that message attachments are Base64-encoded before they are transferred. Thus, the value must be set 33% higher.
( 100 MB * 4/3 (Base64 encoding) = 134 MB = 137216 KB = 140509184 bytes )

  1. Go to your EWS settings file path: %ExchangeInstallPath%ClientAccess\exchweb\ews\

  2. Open the Web.config file with notepad or other text editor.

  3. Locate all maxAllowedContentLength and maxReceivedMessageSize occurrences. Change their values to maxReceivedMessageSize="140509184" and maxAllowedContentLength="140509184" . Please note that you must not change the default values of maxReceivedMessageSize="1048576" for UMLegacyMessageEncoderSoap11Element bindings (http://technet.microsoft.com/en-us/library/hh529949.aspx)

  4. Save the config file.

  5. Run cmd.exe as administrator

  6. Go to %windir%\system32\inetsrv and execute the following command:
    appcmd.exe set config "Default Web Site/ews" -section:requestFiltering -requestLimits.maxAllowedContentLength:140509184

  7. Execute the following command: iisreset

    1. Hint: For larger environments which do not use multi-role servers, it could be required to alos adjust values in %ExchangeInstallPath%FrontEnd\HttpProxy\EWS\web.config.