设置jsonSerialization

设置jsonSerialization

本文介绍了设置jsonSerialization maxJsonLength在ASP.net Web.Config中给出了500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我不断收到500 - 在我的.NET网站内部服务器错误页面,当我在我的web.config中设置maxJsonLength

So, I keep getting the 500 - Internal server error page on my .net site when I set the maxJsonLength in my web.config.

我修改的.config因为即使我用MaxJsonLength = Int32.MaxValue在我的vb.net JavaScriptSerializer,我还是得到InvalidOperationException异常的大字典我试图发送即使它是远远低于4GB在MaxJsonLength @ Int32.MaxValue允许甚至认为4MB默认限制。

I'm modifying the .config because even though I use MaxJsonLength = Int32.MaxValue on my vb.net JavaScriptSerializer, I'm still getting InvalidOperationException for a large dictionary i'm trying to transmit even though it's well below the 4GB the MaxJsonLength @ Int32.MaxValue allows or even the supposed 4mb default limit.

我用toolkitscriptmanager如果这意味着什么。

I'm using toolkitscriptmanager if that means anything.

  <system.web.extensions>
<scripting>
  <webServices>
    <jsonSerialization maxJsonLength="2147483647"/>
  </webServices>
</scripting>

这并没有帮助(实际上,这也给500错误不高于code)

this didn't help (actually, it also gives 500 error without above code)

<sectionGroup name="system.web.extensions" type="System.Web.Extensions">
  <sectionGroup name="scripting" type="System.Web.Extensions">
    <sectionGroup name="webServices" type="System.Web.Extensions">
      <section name="jsonSerialization" type="System.Web.Extensions"/>
    </sectionGroup>
  </sectionGroup>
</sectionGroup>

听到这应该有助于InvalidOperationException异常,但事实并非如此。我拿出来了,还是500错误。

heard this should help with InvalidOperationException, but it didn't. I took it out, and still 500 error.

<add key="aspnet:MaxJsonDeserializerMembers" value="2147483647" />

提前感谢!

修改

同样的问题,但他的解决方案并没有为我工作。最后code他补充说也给了500错误。 Problem以&lt; System.Web.Extensions程序&GT;升级到.NET 4.0 当配置组

Same problem, but his solution doesn't work for me. The last code he added also gives 500 error. Problem with <system.web.extensions> config group when upgrading to .NET 4.0

推荐答案

对我来说,问题是,我把code在web.config的开始。出于某种原因,把它在结束工作。

The problem for me was that I put the code in the beginning of the web.config. For some reason, putting it at the end worked.

不是专家,所以我不知道为什么会工作。

Not an expert, so I have no idea why that worked.

这工作没有最后两个code节,我试图使它发挥作用。

It worked without the last two code sections that I tried to make it work.

这篇关于设置jsonSerialization maxJsonLength在ASP.net Web.Config中给出了500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:05