Recently we ran into an issue that when running any SQL Server Reporting Server report in Microsoft Dynamics AX 2009 the following error was reported:

Error:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing the request on the server. The status code returned from the server was: 500.
URL:
http://fabrikam/ReportServer/ScriptResource.axd?...

 

Also when running the reports from the Report Manager on the Report server we got the same error.

When capturing a Fiddler trace (http://www.fiddler2.com/fiddler2/) we found the following error:

http://fabrikam/Reports/Pages/Report.aspx?ItemPath=%2fDynamics%2fLedgerSRS.Trialbalance.AutoDesign <http://fabrikam/Reports/Pages/Report.aspx?ItemPath=/Dynamics/LedgerSRS.Trialbalance.AutoDesign>
500
<HEAD> <script language="JScript" type="text/Javascript" src="http://blogs.msdn.com/Reports/js/ReportingServices.js"></script>

<TITLE>Error - Report Manager</TITLE>
<link href="http://blogs.msdn.com/Reports/styles/ReportingServices.css"type="text/css" rel="stylesheet">
<META Name="Report Server" CONTENT="http://fabrikam:80/ReportServer <http://fabrikam/ReportServer> ">
<META Name="StackTrace" CONTENT="System.Web.HttpException: The URL-encoded form data is not valid. ---> 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()
--- End of inner exception stack trace ---
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)">

</HEAD>

 

We found that this is a known issue as we had the following Microsoft security update MS11-100 applied and as described in this KB article:
http://support.microsoft.com/kb/2661403

 

The security update describes how ASP.NET now limits the Form key elements to 1000 and describes what changes need to be made in web.config for IIS applications to increase this value. Howver the SQL 2008 Report server does not use IIS, hence the changes must be applied in the web.config file for both report server and report manager.
For this particular issue, we worked around the issue by increasing the values and adding the following lines in web.config for report server (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer) and report manger (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager):

<appSettings>
       <add key="aspnet:MaxHttpCollectionKeys" value="2500" />
       <add key="aspnet:MaxJsonDeserializerMembers" value="2500" />
</appSettings>

 

For more information see http://support.microsoft.com/kb/2661403

 

--author: Egil Ivar Skjold