CodeTwo Base.title

Changing message size limits

Problem:

You would like to change the message size limit set on your target Exchange Server. This may be helpful when uploading large items via Exchange Web Services (EWS) - used by selected CodeTwo products, e.g. migration or backup applications.

Solution:

Depending on your environment, you need to edit the configuration files of Exchange Web Services (EWS) and configure the Transport Service or set your mailboxes properly. Click the following links to read more.

MS Exchange Online (Office 365)

Any attempt to upload items exceeding the Office 365 EWS size limits will result in the 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, the maximum allowed message size in Exchange Online was 25 MB and was not customizable by a tenant admin. This has changed and the maximum message size is now 150 MB, but you need to make sure your Exchange Online mailboxes are actually set to this limit.

See this Microsoft announcement to find out how to check and configure your Office 365 message size limits. Read 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.

MS Exchange Server 2010/2013/2016

When using the CodeTwo Backup software, most likely you will not need to apply the changes listed below. For example, if you find a large item on Exchange Server, and it is properly backed up, you will probably have no problems uploading it back (restoring) to the same Exchange Server. Since the large-sized item in question originates from the same server, it usually means that this particular server accepts such large 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 when you changed the settings below in the meantime.

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

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

Follow the solutions below to adjust the Exchange limits, depending on your version, or read about additional settings:

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

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

In the instructions below, we use a value of 100 MB (equal to 102400 KB or 104857600 Bytes) as an example. You can modify them to suit your needs.

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 the section <system.webserver> and in the subsection <security> you will find the key below whose <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 size of received messages in Transport Service, execute the following PowerShell cmdlet in EMS:
    Set-TransportConfig -MaxReceiveSize 100MB
  9. Restart the machine and you are good to go.

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 the section <system.webserver> and in the subsection <security> you will find the key below whose <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 the section <system.webserver> and in the subsection <security> you will find the key below whose <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 described in this MS Technet article.
  10. Save and close the file.
  11. Open the ems Exchange Management Shell (EMS).
  12. To change the maximum size of received messages in Transport Service, execute the following PowerShell cmdlet in EMS:
    Set-TransportConfig -MaxReceiveSize 100MB
  13. Restart the machine and you are good to go.

Additional settings

Aside from the above, there may be situations where your messages have been migrated or restored to your server, but you cannot reply to them or forward them. This is caused by the default size limits of your send/receive connectors and/or by the sending limits of the Transport Service. 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