Setting the length of JSON(hockblogs.net)

submitted by hockmanhockman(505) 3 years, 5 months ago

Hi there, Today I got the following error message when invoking a webservice from client script: Er is een fout opgetreden tijdens het serialiseren of deserialiseren met de JSON JavaScriptSerializer. De lengte van de tekenreeks overschrijdt de waarde die is ingesteld in de eigenschap maxJsonLength. Or in plain old english: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. The result set is rather large and my client seems to have problems with that. When diving into this problem, I immediately was send to http://www.asp.net/Ajax/Documentation/Live/mref/P_System_Web_Configuration_ScriptingJsonSerializationSection_MaxJsonLength.aspx. Here's what can be found at the remarks of the MaxJsonLength property: The value of the MaxJsonLength property applies only to the internal JavaScriptSerializer instance that is used by the asynchronous communication layer to invoke Web services methods. By default the MaxJsonLenght is 500 characters (according to my web.config file), but here it is stated that the default is 102400 characters. I'm using ASP.NET Ajax Version 1.0! After setting this to 10000000 in my web.config file the problem was solved <system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="10000000"/> </webServices> <scriptResourceHandler enableCompression="true" enableCaching="true"/> </scripting> </system.web.extensions>

add a comment |category: |Views: 62

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story