title: SSRS exceptions Operation is not valid due to the current state of the object. and AspNetSessionExpiredException
body: <p>Within my asp.net application I have a reportview that connects to the ssrs endpoint when running reports with a large number of parameters (select all option in parameter list) I receive the following exception being thrown </p>
  
  <pre><code>Operation is not valid due to the current state of the object.
  </code></pre>
  
  <p>I have seen a number of blogs as well postings here that reference a security patch applied by MS as the contributing cause to this which limits the number of items you can have in a collection to 1000.</p>
  
  <p>I have also seen suggestions to add an appSettings tag within the web.config file for the wcf hosting service located at <code>C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer</code> and add the following entry</p>
  
  <pre><code>&lt;appSettings&gt;
      &lt;add key="aspnet:MaxHttpCollectionKeys" value="20000" /&gt;
    &lt;/appSettings&gt;
  </code></pre>
  
  <p>I have tried this suggestions with no luck. The server running sql2008r2 does not have either of the security updates mentioned and adding the appSettings value to either web.config (config for the ssrs management site or the endpoint) do not have any impact on the exception. I have even increased the value (100000) in the event I had more that 20k items.</p>
  
  <p>My second thought was that the packet size on the wsHttp request may be to large and I need to increase that as well. </p>
  
  <p><strong>Update</strong>
  After digging around some more I have found that I am on the right track. The above was a partial solution according to MS entry <a href="http://support.microsoft.com/kb/2661403" rel="nofollow">KB2661403</a> The MaxCollectionKey was only part of the entry. The second piece is the serialization of the parameters a second entry needs to be added to the appSettings section </p>
  
  <pre><code>&lt;add key="aspnet:MaxJsonDeserializerMembers" value="1000" /&gt;
  </code></pre>
  
  <p>As I started thinking about this I was also incorrect in where this needed to be entered. It did not need to be entered on the SSRS endpoints web.config but on the site hosting the report viewer control. Adding those two entries to the web.config has resulted in the objects being passed across successfully. Now the SSRS system is returning an ASP.NETSessionTimeOut Exception so I need to try to extend this timeout to see if I can get data back on large queries.</p>
  
  <p>Does anyone have any suggestions or recommendations?</p>
  
  <p>-Cheers</p>