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

今天遇到一个asp.net的草郁闷的问题,看下截图

狂晕啊,在google上狂搜了一下,好在已经有大侠也遇到过这个问题了,先看下别人的解决办法吧

Operation is not valid due to the current state of the object.这种类型的错误有很多,很多都是针对linq的,但是如果是下面的错误类型System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302

不过我的是+2419294,这个好像不是确定的吧。。。

那就是因为

因为在这次安全更新中对于asp.net单次的提交量做了一个最大量限制1000,出现这个异常正是因为页面提交量超过了1000这个限制.这个可以在web.config中更改:

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

 OK,问题搞定

原文地址:https://www.cnblogs.com/EWall/p/3171461.html