SSRS JavaScript Error – SharePoint SQL Reporting Services

Here is short detail of a SSRS related issue that I had recently worked on. While rendering the SSRS reports in a project server site we were getting the below JS error.

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near '

<!DOCTYPE html PUB'.

Line: 5

Char: 62099

Code: 0

URI: /ScriptResource.axd?d=">/ScriptResource.axd?d=">/ScriptResource.axd?d=">/ScriptResource.axd?d=">https://<site>/ScriptResource.axd?d=

Issue was related to ASP.NET MAXHttpCollectionKeys limit. While looking at the SharePoint ULS Logs , we could see the below exception.

System.InvalidOperationException: Operation is not valid due to the current state of the object. at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) at System.Web.HttpRequest.FillInFormCollection()

Possible root cause – Microsoft security update MS11-100 limits the maximum number of form keys, files, and JSON members to 1000 in an HTTP request. Because of this change, ASP.NET applications reject requests that have more than 1000 of these elements. HTTP clients that make these kinds of requests will be denied, and an error message will appear in the web browser. SSRS report filtering column were sending as HTTPCollectionKeys and that was reaching the maximum limit.

Followed the Microsoft supported solution in https://support.microsoft.com/kb/2661403

Adding the following to the web.config for the project server web site resolved the issue.

<appSettings>

   <add key="aspnet: MaxHttpCollectionKeys" value="5000" />

</appSettings>

Make sure that if you have multiple Web Frontend servers, then have to add the above entry in all of them. (don’t forget take a backup of the web.config before making any modification)

References:

https://blogs.msdn.com/b/paulking/archive/2012/01/16/using-an-http-module-to-assist-in-adjusting-the-value-of-aspnet-maxhttpcollectionkeys-imposed-by-ms11-100.aspx

https://support.microsoft.com/kb/2661403