异常详细信息: System.InvalidOperationException: 对象的当前状态使该操作无效 真正的解决办法...

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:

[InvalidOperationException: 对象的当前状态使该操作无效。]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692482
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
System.Web.HttpRequest.FillInFormCollection() +148[HttpException (0x80004005): URL 编码窗体数据无效。]
System.Web.HttpRequest.FillInFormCollection() +206
System.Web.HttpRequest.get_Form() +68
System.Web.HttpRequest.get_HasForm() +8743911
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
System.Web.UI.Page.DeterminePostBackMode() +63
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133
[InvalidOperationException]: 对象的当前状态使该操作无效。
在 System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
在 System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
在 System.Web.HttpRequest.FillInFormCollection()[HttpException]: URL 编码窗体数据无效。
在 System.Web.HttpRequest.FillInFormCollection()
在 System.Web.HttpRequest.get_Form()
在 System.Web.HttpRequest.get_HasForm()
在 System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
在 System.Web.UI.Page.DeterminePostBackMode()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: 引发类型为“System.Web.HttpUnhandledException”的异常。
在 System.Web.UI.Page.HandleError(Exception e)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
在 System.Web.UI.Page.ProcessRequest()
在 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
在 System.Web.UI.Page.ProcessRequest(HttpContext context)
在 ASP.content_3csalesweb_employeesaleslistseach_aspx.ProcessRequest(HttpContext context)
位置 c:\Users\aa\AppData\Local\Temp\Temporary ASP.NET Files\web\48229cbb\2dbb4478\App_Web_mfh1pmfe.6.cs:行号 0
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously

 

上述问题的解决方案如下:


ThrowIfMaxHttpCollectionKeysExceeded()
问题在这里.
出现这个异常的原因正是因为上年12月29号那次微软发布的最后一次非正常更新程序引起的.在这次安全更新中对于asp.net单次的提交量做了一个最大量限制1000,出现这个异常正是因为页面提交量超过了1000这个限制

解决办法有两种:

第一种:用分页控制页面数据呈现数据量,尽量把数据放在缓存中,用分页控制数据呈现量,每页100条数据。

第二种:这个可以在web.config中更改
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="5000" />
</appSettings>
 

转载于:https://www.cnblogs.com/yansf/p/3808421.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值