SSRS error: Operation is not valid due to the current state of the object

If you’re using SSRS in SharePoint integrated mode, you may come across this error when using report parameters that have a high number of items in them. A recent security bulletin highlighted some issues and vulnerabilities in ASP.net, and a patch was released to cover some of the items. One of these was the maximum number of items you can have in a collection. If you exceed the limit, then you’ll likely get an error like:

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()

The workaround to this is to add the following to your web.config for your IIS application:

<appSettings>
<add key=”aspnet:MaxHttpCollectionKeys” value=”5000″ />
</appSettings>

where 5000 is a number big enough to cover the number of items in your collection. Be aware of the security implications this could have. There’s some really useful info around the issue, here.

2 Comments

  1. Hi Andy. It’s not the number of parameters, it’s the number of items in a collection IN a parameter. e.g., if you have a single parameter which is a dropdown/choice, then it’s the number of items in the choice that is affected. You need to do this on the MOSS server. (SSRS doesn’t use IIS (in SSRS 2008 anyway.))

  2. Thanks for the post. I couldn’t find anything else so specific toward a SharePoint-integrated environment. Would it not be better to redesign the report(s) impacted by this issue to pass fewer parameters? Also, if the workaround should be used, what IIS server needs the increased value – MOSS or SSRS, since they’re not on the same machine?

1 Trackback / Pingback

  1. Operation is not valid due to the current state of the object | In the SharePoint Trenches

Leave a Reply

Your email address will not be published.


*