当前位置:编程学习 > C#/ASP.NET >>

对象的当前状态使该操作无效

相同的web程序,在其它服务器上能正常提交。但开发服务器会出错。错误信息如下:
Operation is not valid due to the current state of the object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.

在网上查过,说是2011-12-29时的一个微软补丁造成的。在 web.config 中使用以下设置可以解决问题。
<appSettings>
  <add key="aspnet:MaxHttpCollectionKeys" value="5000" />
</appSettings>

我的问题是,以上代码对我的项目无效,无论 value 是 1000,5000,50000。或者更大的值都无效。 --------------------编程问答-------------------- 检查你测试的不同服务器的IIS版本,.net Framework版本有啥不同不
Web.config的配置,不需要重新编译的,应该是你部署服务器的配置不支持 --------------------编程问答-------------------- aspnet:MaxHttpCollectionKeys

哈哈,你这个倒是解决我的问题了 --------------------编程问答-------------------- 顶起来~ --------------------编程问答-------------------- 请问楼主解决了这个问题了吗 --------------------编程问答-------------------- <add key="aspnet:MaxHttpCollectionKeys" value="50000"/> 解决了我的问题,谢谢楼主
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,