码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScriptSerializer 序列化时异常:Operation is not valid due to the current state of the object.

时间:2015-01-04 15:19:16      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:

异常详情:

System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)
   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)
   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)
   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)
   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)
   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)
   at EM.GuBaAPI.Web.MonitorLog.Client.Test.Button5_Click(Object sender, EventArgs e)


原因:

进行了Windows Update,安装了几个补丁,以 kb2656356  kb2656351  kb2656353 kb2656358为主会导致以上错误。


解决方案:

配置文件增加节点

  <add key="aspnet:MaxJsonDeserializerMembers" value="10000" />
注意不要和http请求搞混淆,设置HTTP请求的最大许可为:
<add key="aspnet:MaxHttpCollectionKeys" value="10000" />
详见:微软的官方技术支持:http://support.microsoft.com/kb/2661403/zh-tw

JavaScriptSerializer 序列化时异常:Operation is not valid due to the current state of the object.

标签:

原文地址:http://blog.csdn.net/lxy1106/article/details/42392441

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!