EWS Changing message size limits

 

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). EWS is used by selected CodeTwo products such as migration or backup software.

Solution:

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

MS Exchange Online (Office 365)

Any attempt to upload items exceeding the Office 365 EWS size limits results 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. 
[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 this size could not be modified by a tenant admin. This limit has been 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 article to find out how to check and configure your Office 365 message size limits. Be aware that it may take up to half an hour for the changes to take effect.

Read more about Exchange Online limits on Microsoft's website.

MS Exchange Server 2010/2013/2016/2019

Info

If you use CodeTwo Backup, most likely you will not need to apply the changes listed below. For example, if you find a large item on an Exchange server, and it is correctly 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/2019 does not accept items bigger than 30 MB to be uploaded via EWS. To change that, you need to modify the Exchange EWS web.config file(s) and configure some of the Transport Service settings via the ems Exchange Management Shell, as shown later in this article. If you attempt to upload items exceeding the message size limit, this results in the following (or similar) errors logged to the software's 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 Exchange version, or read about additional settings.

In the instructions below, we use a value of 200 MB (equal to 204800 KB or 209715200 Bytes) as an example. You can modify all values to suit your needs.

Important

  • 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. For example, EWS-based email clients may stop working. Consider those changes as temporary measures that you will revert at the end. We therefore recommend backing up the files you are about to modify.

Exchange 2013/2016/2019

  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 by using any text editor.
  4. Locate maxRequestLength and change its value to 204800.
  5. Locate maxAllowedContentLength and change its value to 209715200.
  6. Save and close the file.
  7. Log on to your target MS Exchange Server Mailbox role machine.
  8. Go to your EWS settings file path:
    %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
  9. Locate maxRequestLength and change its value to 204800.
  10. Locate maxAllowedContentLength and change its value to 209715200.
  11. Locate all occurrences of maxReceivedMessageSize in the file and change their values, for example, to 209715200. Be aware that you must not change the default values of maxReceivedMessageSize for UMLegacyMessageEncoderSoap11Element bindings, as described in this Microsoft article.
  12. Save and close the file.
  13. Open the ems Exchange Management Shell (EMS).
  14. To change the maximum size of received messages in the Transport Service, execute the following PowerShell cmdlet in EMS:
    Set-TransportConfig -MaxReceiveSize 200MB
  15. Restart the machine, and you are good to go.

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 any text editor.
  4. Locate maxRequestLength and change its value to 204800.
  5. Locate maxAllowedContentLength and change its value to 209715200.
  6. Locate all maxReceivedMessageSize occurrences in the file and change their values, for example, to 209715200. Be aware that you must not change the default values of maxReceivedMessageSize for the UMLegacyMessageEncoderSoap11Element bindings.
  7. Save and close the file.
  8. Open the ems Exchange Management Shell (EMS).
  9. To change the maximum size of received messages in the Transport Service, execute the following PowerShell cmdlet in EMS:
    Set-TransportConfig -MaxReceiveSize 200MB
  10. 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 behavior might be caused by the default size limits of your send/receive connectors 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 according to your needs (e.g. to 200 MB):
    Set-TransportConfig -MaxSendSize 200MB
    Set-SendConnector -Identity "<Your Send Connector Name>" -MaxMessageSize 200MB
    Set-ReceiveConnector -Identity "<Your Receive Connector Name>" -MaxMessageSize 200MB

See also:

Microsoft's resources:

Комментарии

Популярные сообщения из этого блога

У вас нет прав для отправки сообщения вместо указанного пользователя. Ошибка: [0x80070005-0x0004dc-0x000524]

Поиск и удаление писем в ящиках Exchange Server

KSMG Подготовка конфигурационных файлов для подключения к LDAP