How to modify Exchange message size limit

How to modify Exchange message size limit

Problem:

When you use RecoveryManager Plus to restore backups of a mailbox from one Exchange server to another, you might encounter issues if the Exchange message size limit for the target server is lesser than that of the source server.

Another possible scenario when you might have problems in restoring mailbox data is if you had changed the message
size limits after the backup was taken. 

Possible error messages:

  • [ErrorInvalidRequest] - The request is too large. Reduce the size of the request and try again.
  • The request failed with HTTP status 507: Insufficient Storage.
  • [ErrorMessageSizeExceeded] - The message exceeds the maximum supported size.

Solution:

You’ll have to increase the Exchange message size limit by modifying the Exchange EWS Web.config file(s) and make small changes to the TransportConfig, SendConnector, and ReceiveConnector tags via the Exchange Management Shell (EMS). 

Depending on the version of your Microsoft Exchange Server, the steps to be followed differ slightly. 

  1. Microsoft Exchange Server 2010
  2. Microsoft Exchange Server 2013/2016/2019


1. Microsoft Exchange Server 2010

  • Log in to the Microsoft Exchange Server CAS role machine.
  • Navigate to the location where the EWS settings file is present.  

%PROGRAMFILES%\Microsoft\Exchange Server\V14\ClientAccess\exchweb\ews\

  • Open Web.config file with any text editor like Notepad.
  • Locate all instances of the tag maxReceivedMessageSize in the Web.config file and change their values. In this example, we’ll change the maximum message size to 157286400, which is 150MB .
            Important: Do not change the default values of  maxReceivedMessageSize for the  UMLegacyMessageEncoderSoap11Element bindings. For more information on why this value should not be changed, check out this  Microsoft article
  • Locate the section <system.webserver>, and in its subsection <security>, find the key <requestLimits maxAllowedContentLength="<value>" /> and change the <value> to 157286400.
  • Save and close the file.
  • Open Exchange Management Shell.
  • To change the maximum size of received messages in the TransportConfig, SendConnector, and ReceiveConnector tags, execute the following PowerShell cmdlets in EMS.

Set-TransportConfig -MaxReceiveSize 150MB 

Set-SendConnector -Identity "<Your Send Connector Name>" -MaxMessageSize 150MB

Set-ReceiveConnector -Identity "<Your Receive Connector Name>" -MaxMessageSize 150MB

  • Restart the machine for the modified message size limits to take effect.


2. Microsoft Exchange Server 2013/2016/2019


  • Log in to your Microsoft Exchange Server CAS role machine.
  • Navigate to the location where your EWS settings file is present. 

 %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config

  • Open the Web.config file by using any text editor like Notepad.
  • Locate the section <system.webserver>, and in its subsection <security>, find the tag <requestLimits maxAllowedContentLength="<value>" /> and change the <value> to 157286400.
  • Save and close the file.
  • Log in to your Microsoft Exchange Server Mailbox role machine.
  • Navigate to the location where your EWS settings file is present. 
             %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
  • Locate the section <system.webserver>, and in its subsection <security>, find the key <requestLimits maxAllowedContentLength="<value>" /> and change the <value> to 157286400.
  • Locate all instances of the tag maxReceivedMessageSize in the Web.config file and change their values. In this example, we’ll change the maximum message size to 157286400, which is 150MB in Bytes. 
             Important: Do not change the default values of  maxReceivedMessageSize for the  UMLegacyMessageEncoderSoap11Element bindings.  For more information on why this value should not be changed, check out this  Microsoft article .
  • Save and close the file.
  • Open Exchange Management Shell.
  • To change the maximum size of received messages in the TransportConfig, SendConnector, and ReceiveConnector tags, execute the following PowerShell cmdlets in EMS.

Set-TransportConfig -MaxReceiveSize 150MB 

Set-SendConnector -Identity "<Your Send Connector Name>" -MaxMessageSize 150MB

Set-ReceiveConnector -Identity "<Your Receive Connector Name>" -MaxMessageSize 150MB

  • Restart the machine for the modified message size limits to take effect.