加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – ASP错误:由于对象的当前状态,操作无效

发布时间:2020-12-15 18:34:06 所属栏目:asp.Net 来源:网络整理
导读:尝试在一个相当复杂的ASP.net页面上调试一个随机错误,有很多ADO.net MS-SQL是我开始麻烦拍摄的地方。但是至今,我还没有把它缩
尝试在一个相当复杂的ASP.net页面上调试一个随机错误,有很多ADO.net MS-SQL是我开始麻烦拍摄的地方。但是至今,我还没有把它缩小。有趣的是当我在VS本地调试代码(对同一个DB连接)我没有得到错误。然而,当代码针对IIS运行时,会引发以下错误。有人遇到过类似的东西吗?

源错误:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location
of the exception can be identified using the exception stack trace
below.

堆栈跟踪:

[InvalidOperationException: Operation is not valid due to the current state of the    object.]
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes,Encoding encoding)  +11368719
System.Web.HttpRequest.FillInFormCollection() +329

[HttpException (0x80004005): The URL-encoded form data is not valid.]
   System.Web.HttpRequest.FillInFormCollection() +11482818
   System.Web.HttpRequest.get_Form() +157
   System.Web.HttpRequest.get_HasForm() +11483620
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +141
   System.Web.UI.Page.DeterminePostBackMode() +100
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean  includeStagesAfterAsyncPoint) +259

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

解决方法

可能与 this issue有关吗?建议的解决方法是在web.config中添加以下内容:
<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>

Scott Gu也在blogged关于ASP.NET中发现的这个漏洞。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读