Operation is not valid due to the current state of the object

Version 1


    When running a report the following error is recieved.





    If you look at the second line of the error message, you can see that part of the error says “throwifmaxhttpcollectionkeysexceeded”.  Based on that, this looks to the maxhttpcollectionkeys issue.  This is a change Microsoft made to IIS where you have to specify the maximum number of items in a collection, such as a listbox.  I believe they did this because of bugs in their code that could cause a security breach.




    To resolve the issue modify the web.config and add the following line into the appsettings section:


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