Memorise

Cannot send large messages via ActiveSync, iPhone/iPad

SYMPTOMS

When sending from a Mobile device via the ActiveSync service the device fails to send.

Some devices may return an error indicating that “The message that was sent to the server was rejected because the message was too large”. (Apple iPad iOS). Not all mobile devices behave this way and may just keep the message in the outbox folder and retried until removed from the folder.

CAUSE

Ther are number of reasons, couple of them listed below.

CAUSE 1

First one I have found is ActiveSync limit set to 10MB (%ExchangeInstallPath%ClientAccess\Sync\web.config maxRequestLength=”10240″)

CAUSE 2

A global IIS restriction preventing uploads larger than 49152 Bytes.

IIS 7.5 sets a default value of 49152 Bytes for the “UploadReadAheadSize” value which limits the amount of bytes allowed in the entity body of a request and the number of bytes a Web server will read into a buffer and pass to an ISAPI extension.

Diagnosis:

  • Navigate within IIS to the “Sites” node.
  • Determine the ID for the “MailEnable Protocols” website
  • Next navigate to the IIS log files path: C:\inetpub\logs\LogFiles
  • Locate the W3SVC(ID) folder, where ID is the number of the website ID above in step 2.
  • Sort the log files by “Date Modified’ and then open the latest log files in respect to the date/time you sent the message from the mobile device.
  • Search for lines like the examples below:

2020-03-27 20:33:38 192.168.0.1 POST /Microsoft-Server-ActiveSync User=test@myenroutetest.it&DeviceId=ApplDMRL2W3PF169&DeviceType=iPad&Cmd=SmartForward 443 – 192.168.0.2 Apple-iPad3C4/1102.55400001 413 0 0 6396

2020-03-27 20:33:38 192.168.0.1 POST /Microsoft-Server-ActiveSync User=test@myenroutetest.it&DeviceId=ApplDMRL2W3PF169&DeviceType=iPad&Cmd=SendMail 443 – 1921.68.0.2 Apple-iPad3C4/1102.55400001 413 0 0 6396

The above log snippets report a 413 error in the line which indicates the “Request Entity is too large”.

CAUSE 3

Incorrect authentication settings in Exchange Server Virtual Directory.

RESOLUTION – 1

Change the limit set on web.config, note this settings below for Frontend backed servers with different CAS and Mailbox server. For single server web.config is located in

C:\Program Files\Microsoft\Exchange Server\v14\ClientAccess\Sync\web.config has the following lines of code:

<system.web>
                         <!– Allow maximum 10 megs of content –>
                         <httpRuntime madRequestLength=”10240″ />

v14 is different verions of Exchange.

ActiveSync

Server roleConfiguration fileKeys and default valuesSize
Client Access%ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.configmaxAllowedContentLength="30000000 bytes"   Not present by default (see comments).bytes
Client Access%ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.configmaxRequestLength="10240"kilobytes
Mailbox%ExchangeInstallPath%ClientAccess\Sync\web.configmaxAllowedContentLength="30000000 bytes"   Not present by default (see comments).bytes
Mailbox%ExchangeInstallPath%ClientAccess\Sync\web.configmaxRequestLength="10240"kilobytes
Mailbox%ExchangeInstallPath%ClientAccess\Sync\web.config<add key="MaxDocumentDataSize" value="10240000">bytes

Comments on ActiveSync limits

By default, there is no maxAllowedContentLength key in the web.config files for ActiveSync. However, the maximum message size for ActiveSync is affected by the maxAllowedContentLength value that is applied to all web sites on the server. The default value is 30000000 bytes (30 MB). To see these values for ActiveSync on Client Access Servers and Mailbox servers in IIS Manager, perform the following steps:

  1. Do one of the following steps:
    • On Client Access servers, open IIS Manager, navigate to Sites > Default Web Site and select Microsoft-Server-ActiveSync.
    • On Mailbox servers, open IIS Manager, navigate to Sites > Exchange Back End and select Microsoft-Server-ActiveSync.
  2. Verify Features View is selected, and double-click Configuration Editor in the Management section.
  3. Click the dropdown arrow in the Section field, navigate to system.webServer > security and select requestFiltering.
  4. In the results, expand requestLimits, and you’ll see maxAllowedContentLength and the default value 30000000 (bytes).

To change the maxAllowedContentLength value, enter a new value in bytes, and click Apply. You need to change the value on Client Access servers and on Mailbox servers. After you change the value in IIS Manager, a new maxAllowedContentLength key is written to the corresponding web.config file (%ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config on Client Access servers, and %ExchangeInstallPath%ClientAccess\Sync\web.config on Mailbox servers).

To change the maximum message size for ActiveSync clients, you need to change the value of maxRequestLength in the web.config file on Client Access servers and Mailbox servers, MaxDocumentDataSize in the web.config file on Mailbox servers, and maxAllowedContentLength in IIS Manager on Client Access servers and Mailbox servers.

  • RESOLUTION – 2
  • Open a Windows command prompt with administrator rights and navigate to the following location: C:\inetpub\AdminScripts
  • Run the following command: cscript adsutil.vbs set w3svc/14/uploadreadaheadsize 51200000

Where “14” in the above command is the website ID

RESOLUTION – 3

Check the virtual directory authentication settings in the Exchange server for
EWS (Default Web Site), it should be
Integrated windows authentication only and for

Microsoft-Server-ActiveSync (Default Web Site) authentication set to
Basic authentication and ignore client certificate


Categorised as: Exchange, Microsoft, Networking


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.