Rendering a large report in SharePoint mode fails with maximum message size quota exceeded error message

Recently, i was working on a scenario where reporting services 2012 was configured in SharePoint 2013 integrated mode. We were exporting a report that was ~240MB in size. When we do that, the reports fails with the following exception:

07/19/2017 13:37:57.46  w3wp.exe (0x2C80)                        0x0834 SQL Server Reporting Services  Service Application Proxy      00000 Monitorable Notified the load balancer and raising RecoverableException for exception: System.ServiceModel.CommunicationException: The maximum message size quota for incoming messages (115343360) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. ---> System.ServiceModel.QuotaExceededException: The maximum message size quota for incoming messages (115343360) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.     --- End of inner exception stack trace ---    Server stack trace:      at System.ServiceModel.Channels.MaxMessageSizeStream.PrepareRead(Int32 bytesToRead)     at System.ServiceModel.Channels.MaxMessageSizeStream.Read(Byte[] buffer, Int32 offset, Int32 count)    ... 00c1069e-df14-5005-0000-0ec04d857de3

To resolve the issue, there are few config files that you need to modify the value that was defined as 115343360 which is 115MB. This is a two step process.

1. First, you need to go to the SharePoint app servers that hosts Reporting Services service application. This can be identified by:

SharePoint central administration -> System Settings -> Manage Servers in Farm and make a note of the servers that are hosting "SQL Server Reporting Services Service"

2. In each of the machines that are identified in #1, go to the web.config file located under:

"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\WebServices\Reporting\"

3. Take a backup of the file.

4. Open it in a text editor and locate the <bindings> section.

5. Replace all the 115343360 values with 2147483647. The value is ~2GB

6. Save and close the file. Here is how the modified version would look like. Please do modify any other values in the below section to reflect what you see below.

<customBinding>
<binding name="http" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport" allowInsecureTransport="true" />
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
<binding name="https" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport" />
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpsTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
</customBinding>

7. Perform an IISRESET.

8. Remember, the steps #2 thro' #7 has to be done on all the machines identified in step #1.

9. Secondly, you need to go to each of the SharePoint WFE server including the app servers (that hosts Reporting services which was identified on step #1) and locate client.config file from the following location:

"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\WebClients\Reporting\"

10. Take a backup of the file.

11. Open it in a text editor and locate the <bindings> section.

12. Replace all the 115343360 values with 2147483647. The value is ~2GB

13. Save and close the file. Here is how the modified version would look like. Please do modify any other values in the below section to reflect what you see below.

<customBinding>
<!-- These are the HTTP and HTTPS bindings used by all endpoints except the streaming endpoints -->
<binding name="http" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport" allowInsecureTransport="true" />
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
<binding name="https" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport" />
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpsTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
<!--
These are the HTTP and HTTPS bindings used ONLY by the streaming endpoints.

Details:
1) The only difference between these bindings and the ones above is that these include long
running operations causing the security timestamp in the header to become stale.
In order to avoid staleness errors, the maxClockSkew is set to 1 hour.
2) Any changes made to the above bindings should probably be reflected below too.
-->
<binding name="httpStreaming" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport" allowInsecureTransport="true">
<localClientSettings maxClockSkew="01:00:00" />
</security>
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
<binding name="httpsStreaming" sendTimeout="01:00:00" receiveTimeout="01:00:00">
<security authenticationMode="IssuedTokenOverTransport">
<localClientSettings maxClockSkew="01:00:00" />
</security>
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binaryMessageEncoding>
<httpsTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" transferMode="Streamed" authenticationScheme="Anonymous" />
</binding>
</customBinding>

14. Perform an IISRESET.

15. Remember, the steps #9 thro' #14 has to be done on all the WFE machines as well as the app servers (that hosts Reporting services which was identified on step #1).

Now the large report that you are trying to export should come up fine as expected be it from within SharePoint or from any custom application.

This article applies to all the reporting services version from SSRS 2012 thro' SSRS 2016 and for SharePoint 2010 thro' SharePoint 2016. The path referenced in steps #2 and #9 varies between 14 / 15 / 16 according to the SharePoint versions 2010 / 2013 / 2016 respectively.

Hope this helps!

Selva.

[All posts are AS-IS with no warranty and support]