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

今天在操作gridview 自动新增行的时候,每行有约六十个字段,数据量提交比较大,到第16、17行的时候,就自动报错“Operation is not valid due to the current state of the object.”  ,经网上查询,解决了这个问题。

            以下为转载地址及文章:http://blog.csdn.net/dongxiaohui2008/article/details/8424082


异常信息: Operation is not valid due to the current state of the object.
错误源:System.Web
堆栈信息:   at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
   at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
   at System.Web.HttpRequest.FillInFormCollection()

分析异常信息:System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded():很有可能是在页面提交时,某个数据过大导致。

有个数据维护程序,最近一直报这个错误,以前一直OK,程序没做过变动,经研究发现原来是微软发布的一次更新引起的.在这次安全更新中对于asp.net单次的提交量做了一个最大量限制1000,出现这个异常正是因为页面提交量超过了1000这个限制.这个可以在web.config中增加参数来更改。

解决方法:
<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
value值根据需要可适当的修改。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值