gpt4 book ai didi

asp.net - ASP 错误 : Operation is not valid due to the current state of the object

转载 作者:行者123 更新时间:2023-12-02 06:40:04 31 4
gpt4 key购买 nike

尝试在相当复杂的 ASP.net 页面上调试随机错误,其中有大量的 ADO.net MS-SQL,这是我开始排除故障的地方。但到目前为止我还无法缩小范围。有趣的是,当我在 VS 中本地调试代码(针对相同的数据库连接)时,我没有收到错误。然而,当代码针对 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 中发现的此漏洞。

关于asp.net - ASP 错误 : Operation is not valid due to the current state of the object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8978929/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com