CodeTwo Base.title

Changing the message size limit

Problem:

How to change the message size limit set on your target Exchange Server. This may be helpful when uploading big items via Exchange Web Services (EWS) - used by some CodeTwo software e.g. migration or backup applications.

Solution for MS Exchange Online (Office 365):

Attempting to upload items bigger than Office 365 EWS limits will result in following or similar errors logged to the software's mailbox log files:

Error while uploading package. System.Exception: The underlying connection was closed: An unexpected error occurred on a send. 

or

[ErrorMessageSizeExceeded] - The message exceeds the maximum supported size., Cannot save changes made to an item to store.

Until April, 2015, maximum allowed message size in Exchange Online was 25MB and was not customizable by tenant admin. This has changed and the maximum message size is now 150MB, however, you must make sure your Exchange Online mailboxes are actually set with this limit.

See this Microsoft announcement to find out how to check and configure your Office 365 message size limits. Read on more about Exchange Online limits in Microsoft Technet. Be aware that it may take up to half an hour for the changes to take effect.

Solution for MS Exchange Server 2010/2013/2016:

When using CodeTwo Backup software you will most likely do not need to apply the below listed changes. If you found on the Exchange Server a big item and it was properly backed up it is rather less probable you will have problems uploading it back (restoring) to the same Exchange Server. Since the big item in question originated on the same server it usually means that this particular server accepts such big items. Of course, this does not apply to scenarios in which you want to restore items to a different server than the original one or you changed the below listed settings in the meantime.

By default MS Exchange Server 2010/2013/2016 will not accept items bigger than 10MB to be received via EWS. To change that you will have to follow the below steps to modify Exchange's EWS web.config file(s) and configure some Transport Service settings via ems Exchange Management Shell. If you attempt to upload items exceeding the message size limit, this will result in following or similar errors logged to the software log files:

  • Errors caused by too low maxReceivedMessageSize value,
    [ErrorInvalidRequest] - The request is too large. Reduce the size of the request and try again.
  • Errors caused by too low requestLimits maxAllowedContentLength value,
    The request failed with HTTP status 507: Insufficient Storage.
  • Errors caused by too low or no yet set TransportConfig MaxReceiveSize value,
    [ErrorMessageSizeExceeded] - The message exceeds the maximum

Follow the steps below to adjust the Exchange limits:

Be aware that here mentioned settings are applied globally - it is not possible to limit them to particular mailboxes or group of users.

Applying the changes might affect some of your services that also rely on them, for example, EWS-based email clients can stop working. Consider those changes as temporary ones that you will revert at the end. We therefore, recommend to backup any files you are about to modify prior to actually changing them.

In the instructions below we have used a value of 100MB (102400 in KB and 104857600 in Bytes) as an example. You can modify them to suit your needs.

Solution for Exchange 2010

  1. Log on to your target MS Exchange Server CAS role machine.
  2. Go to your EWS settings file path:
    %PROGRAMFILES%\Microsoft\Exchange Server\V14\ClientAccess\exchweb\ews\
  3. Open the file Web.config with notepad or other text editor.
  4. Locate all maxReceivedMessageSize occurrences in the file and change their values to 104857600. Be aware that you must not change the default values of  maxReceivedMessageSize for UMLegacyMessageEncoderSoap11Element bindings.
  5. Locate section <system.webserver> and in subsection <security> you will find the below key which <value> must be set to 104857600:
    <requestLimits maxAllowedContentLength="<value>" />
  6. Save and close the file.
  7. Open the ems Exchange Management Shell (EMS).
  8. To change the maximum received message size in Transport Service execute the following PowerShell Cmdlet in the EMS:
    Set-TransportConfig -MaxReceiveSize 100MB
  9. Restart the machine and you are good to go.

Solution for Exchange 2013 / 2016

  1. Log on to your target MS Exchange Server CAS role machine.
  2. Go to your EWS settings file path:
    %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config
  3. Open the file Web.config with notepad or other text editor.
  4. Locate section <system.webserver> and in subsection <security> you will find the below key which <value> must be set to 104857600:
    <requestLimits maxAllowedContentLength="<value>" />
  5. Save and close the file.
  6. Log on to your target MS Exchange Server Mailbox role machine.
  7. Go to your EWS settings file path:
    %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
  8. Locate section <system.webserver> and in subsection <security> you will find the below key which <value> must be set to 104857600:
    <requestLimits maxAllowedContentLength="<value>" />
  9. Locate all maxReceivedMessageSize occurrences in the file and change their values to 104857600. Be aware that you must not change the default values of  maxReceivedMessageSize for UMLegacyMessageEncoderSoap11Element bindings, as per this MS Technet article.
  10. Save and close the file.
  11. Open the ems Exchange Management Shell (EMS).
  12. To change the maximum received message size in Transport Service execute the following PowerShell Cmdlet in the EMS:
    Set-TransportConfig -MaxReceiveSize 100MB
  13. Restart the machine and you are good to go.

Additional settings

Aside from the above we also recommend to modify your send and receive connectors maximum message size settings and maximum send size setting in Transport Service to avoid situation in which users have their big emails in mailboxes but cannot forward them to anyone. To change these settings use the ems Exchange Management Shell:

  1. Check your connectors names and current settings:
    Get-SendConnector | Format-List -Property Identity, MaxMessageSize
    Get-ReceiveConnector | Format-List -Property Identity, MaxMessageSize
  2. Set the limits to suit your needs:
    Set-TransportConfig -MaxSendSize 100MB
    Set-SendConnector -Identity "<Your Send Connector Name>" -MaxMessageSize 100MB
    Set-ReceiveConnector -Identity "<Your Receive Connector Name>" -MaxMessageSize 100MB

See also:

Microsoft resources:

Our Clients:
Unicef
Facebook
Shell
T-Systems
Loreal
Casio
UPS Israel
Oford University
Mitsubishi Motors
Toshiba TEC UK Imaging Systems Ltd
Illinois Institute of Technology
MAN Diesel
McDonalds India
Skoda Auto
Bank of Israel
Fujifilm
China Mobile
Santander
Samsung SDI
Skanska
Generali
Telmex
Toyota Tsusho
BECHTEL
Ricoh
BAE SYSTEMS
Federação Portuguesa de Futebol
Credit Agricole
HYUNDAI
Rothschild
Toyota Boshoku
Oriflame Romania
ING
Ikea
Nordea

Partners, certificates & awards