Json_MaxJsonLengthExceeded

15 replies. Last post: September 23, 2013 12:48 AM by Yudi
Tags :
  • (None)
Frank GaryMember

Gentlemen,

I have run into a serious problem in my webscheduler. When loading the webscheduler in my application I am receiving a "Json_MaxJsonLengthExceeded".  See attached screen shot image. Additional information as follows:

1). The Json error ONLY occurs when my events records EXCEED 2450 records (approximate).

2). I have tried changing my webconfig setting <jsonSerialization maxJsonLength="524288" />

     to <jsonSerialization maxJsonLength="2147483647" /> to no avail

3). I am using SQL Server Enterprise 2008 X64 with Windows 7 Ultimate on IIS7.5

4). My webscheduler is version 3.x

5). In my webscheduler properties, I have changed my General > EnableFastJsonSerialization setting from True to False. When I do this the webscheduler does not load any data, or if it does eventually load it takes longer than 5 minutes as I have not let it try to load for longer than 5 minutes before closing the page.

My application can and will have over 100,000 records in the events table within the first year. Will the webscheduler be robust enough to handle this?

Please advise as to how to resolve this Json error.

Thanks - Frank

 

1 attachment

All Replies

Yudi Member
...

My application can and will have over 100,000 records in the events table within the first year. Will the webscheduler be robust enough to handle this?

...

Yes, the WebScheduler will robust enough to handle this. Please ensure that you have enable the EnableFastJsonSerialization property and manually set the MaxJsonLength property of WebScheduler in web.config as shown in the following snippet code.

<add key="ISNet.WebUI.WebScheduler.v3_0_1000.MaxJsonLength" value="number"/>

Hope this helps.

Hi Yudi,

Thank you for your reply. Unfortunately your suggestions did not work and I am still getting the error.

One question: is the value="number" supposed to be a number? I tried it several ways including value="number", value="524288" and value="999999999" to no avail. I also have another json reference in my webconfig as follows:

<system.web.extensions>
    <scripting>
      <webServices>
        <authenticationService enabled="true" />
        <jsonSerialization maxJsonLength="524288" />
      </webServices>
    </scripting>
  </system.web.extensions>

However I tried your snippet with and without the other json reference and no success.

I am also assuming your snippet should be placed in the same add key reference section as the other intersoft references?

Please advise and thanks - Frank

 

Yudi Member

...One question: is the value="number" supposed to be a number? I tried it several ways including value="number", value="524288" and value="999999999" to no avail...

Yes, you are correct. The value=”number” is supposed to be a number (as illustrated in the following snippet code).

<configuration>
  <appSettings>
    ...
    <add key="ISNet.WebUI.WebScheduler.v3_0_1000.MaxJsonLength" value="2147483647"/>
    ...
  </appSettings>  
</configuration>

WebScheduler has its own maximum length for JSON strings. The default value is 5 MB. It is recommended to remove the other JSON reference in your web.config file and use the WebScheduler’s MaxJsonLength declaration as shown in the above snippet code. Please note that you need to enable the EnableFastJsonSerialization property.

  • Could you please inform us the view mode that used by WebScheduler when the problem happen? Is it Agenda view; or Custom view; or Day view; or Month view; or Quarter view; or Timeline view; or Week view; or Year view?
  • If Timeline view is used as the selected view mode, are there any additional settings such as: enable server paging or client paging, etc?
  • If the problem still persists, I’d like to suggest you to utilize the HttpWatch tool to determine the size of sent data. After we can determine the data size, we can set the MaxJsonLength property of WebScheduler to be bigger than this number.
  • Do the retrieved records have many recurring events? For example, a single event which is recurring five times means that the sent data will be five times bigger than a single one.

Look forward to hearing back from you.

Yudi,

Thank you for your continued assistance in helping me resolve this issue. I have been unavailable the past several days to continue troubleshooting.

I will however try your suggestions within the next 1-2 days and reply back in this thread with further information.

Thanks again -

Frank

 

Hi Yudi,

I believe I have resolved the problem.

I changed the LoadOnDemandMode from TripleLoad to SingleLoad and the problem appears to be resolved.  Whether the json reference is included or not in the webconfig file, setting to SingleLoad resolves the problem.

However, I am now wondering if there will be a future or long term performance "hit" due to the setting change?

Also, the answers to your above posted questions are as follows:

1). The mode does not seem to matter, setting for timeline, day, month etc. invokes the json error in tripleload, however my default view is timeline.

2). Client and server paging are both set to True, setting them to False did not make a difference in TripleLoad.

3). Did not troubleshoot with HttpWatch.

4). There are no recurring events in my application, the tables are empty.

Please advise and thanks!

Frank

 

Yudi Member

The Triple-load mode will pre-load the next and previous data along with the current data. With this approach user can see the data directly when they go to previous data and/or next data.

Unlike the Triple-load mode, the Single-load mode will only load the current data, this will reduce the traffic for first time load, but when user navigate to previous data and / or next data, they will need to wait for the data to be loaded prior the rendering process.

Your decision to change the LoadOnDemandMode into SingleLoad is correct. There will be no performance problem in the future. Should you find any, please feel free to let us know, we’ll be glad to assist you again.

Gentlemen,

This problem has arisen again and my application is now broken in a mission critical client production environment. The webscheduler3 is set for single load. The strange thing is the users can view the current day or any day in the future, but when they click an any day in the past the maxjson error occurs and freezes the control. The view that is being used by default is the timelineview.

In the webconfig the maxjson length is set for 2147483647

Is there any way I can pay for right now technical support? As I said my client application is down!

Please help!!!

Yudi Member

In the following, I will describe the step-by-step to analyze and solve problem that occur in WebScheduler especially dealing with the “MaxJsonLengthExceeded” problem.

WebScheduler has its own maximum length for JSON strings. The default value is 5000000 byte (5 MB approx.). It is recommended to remove the other JSON reference in your web.config file and use the WebScheduler’s MaxJsonLength declaration as shown in the following snippet code.

<configuration>
	<appSettings>
		...
    <add key="ISNet.WebUI.WebScheduler.v3_0_1000.MaxJsonLength" value="5000"/>
    ...
	</appSettings>
	...
</configuration>

Please note that you need to enable the EnableFastJsonSerialization property of WebScheduler.

First, let’s modify the value of MaxJsonLength property of WebScheduler to a smaller number so that we can reproduce the reported problem.

  • Open C# Samples project of WebScheduler (start > All Programs > Intersoft WebUI Studio 2012 R2 > WebUI Studio for ASP.NET > WebScheduler 3 > C# Samples);
  • Open Web.config file of the project and add following key under appSettings. This modification will set MaxJsonLength of WebScheduler to 5 KB approx.;
    <configuration>
    	<appSettings>
    		...
        <add key="ISNet.WebUI.WebScheduler.v3_0_1000.MaxJsonLength" value="5000"/>
        ...
    	</appSettings>
    	...
    </configuration>
  • Find LoadOnDemand_SingleLoad.aspx sample file and set the value of EnableFastJsonSerialization property of WebScheduler1 to True. Save the changes and view the sample in the browser;
  • Reported problem is reproducible (as shown in the following screenshot).

Next, I’ll show you what may cause the problem.

  • Open Web.config file of the project and set the appSettings into the following. This modification removes the “MaxJsonLength” of WebScheduler and thus revert the value back to its default value.
    <configuration>
    	<appSettings>
    		...
        <!--<add key="ISNet.WebUI.WebScheduler.v3_0_1000.MaxJsonLength" value="5000"/>-->
        ...
    	</appSettings>
    	...
    </configuration>
  • Save the change and view LoadOnDemand_SingleLoad.aspx sample file in IE browser.
  • Now, the page loaded with no issues.
    Press F12 to open the Developer Tools window of IE, select Network tab, and press the Start capturing button.
  • Back to the browser window and press Ctrl+F5 to refresh the page.
  • After the page completely re-rendered, switch the view to the Developer Tools window and then press the Stop capturing button.
  • In the summary view, we should be able to find two URL which has application/json as the type. Each for RetrieveCalendarEvents action (10.27 KB) and RetrieveEventViews action (70.04 KB).

It is obvious that when we set the value of MaxJsonLength to a certain number which is sufficient for the Json response, the problem is no longer persist.

Please try to do the same and let us know whether this helps or not.

Yudi,

Thank you for your reply. We performed all the above analysis prior to my post, and again after your recent reply.

You stated >

"It is obvious that when we set the value of MaxJsonLength to a certain number which is sufficient for the Json response, the problem is no longer persist. WebScheduler has its own maximum length for JSON strings. The default value is 5000000 byte (5 MB approx.).

Our analysis indicates that is the problem! Our queries are passing more than 5mb! If we set the maxjsonvalue to the max value of 2147483647 we are able to see more data records on the control, but still receive the error when clicking different calender days at random. I am assuming the control is limited to jason value of 5000000 bytes, (probably in a dll?), and this seems to be the underlying issue.

Please advise and thanks -

Frank

Yudi Member

Have you tried to enable Client Paging and Server Paging of WebScheduler?

Client paging can be enabled in Day, Week, Timeline, and Split view. In Month view, it is enabled by default, since the layout structure requires it to be implemented when large data is used. The snippet code below shows how to enable client paging in Day view.

<DayView EnableClientPaging="true" AllDayEventPageSize="10" EventBlockSize="5" />

It is also suggested to utilize server paging in Timeline view mode. With server paging, WebScheduler downloads only a small chunk of data based on the viewport during initial load and intelligently request more data as user scrolls downward. Please note that Server paging feature is only applicable when the client paging is set to ViewPort or Both. The code below shows how to enable server paging in Timeline view.

<TimelineView Enabled="True" EnableClientPaging="true" ClientPagingMode="Both" EnableServerPaging="true" />

Please kindly check the code in HighPerformanceScheduler.aspx sample file for more detail information.

If the problem still persists, could you please send us a working simple sample which replicates the problem? You may also edit one of WebScheduler’s sample file or add more events into it. Please send the sample file so that we can assist you further.

Hi Yudi,

Thank you for your continued assistance, it is greatly appreciated. Here is what we have analyzed;

1). Client and server paging have always been set for true

2). Tried clientpagingmode set for Both and ViewPort

3). Tried just about every other setting we could conceive of the past 3 full days.

4). We also noticed some of the the other views, like month view also return the same problem.

5). We are able to select any calendar day in the future and 3 days in the past, but any date selected in the past that is more than 3 days behind the current day returns the json error.

6). We noticed in our analysis that the json call made by the webscheduler seems to be sending the selected calendar date as (- 30 days) in the query and perhaps even loading the whole 30 days of past data which may be overloading the json. For example attached file "Record_09102013_WithError" illustrates a selected date of 09/10/2013 but the query shows .2013.8.10 which throws the json error. Also if we simply click the calender month to go back a month from september to august same json error.

Attached file "Record_09172013_WithoutError" illustrates a selected date of 09/17/13, (todays date), and the query shows .2013.8.17. but the json error is not thrown.

We are not sure what to provide as far as your requested "working sample", please provide specific details. Also, it would be highly beneficial to be able to conduct a webex or teamviewer support session to help us expedite this issue, as stated before our client application is malfunctioning due to the above issues. I am willing to pay for any real time help required to assist us in resolving the issue!

Please advise and thanks -

Frank

 

Yudi Member

It seems that you forgot to attach the Record_09102013_WithError.png.

Please allow me to explain about the information that I got from Record_09172013_WithoutError.png file.

The WebSchedulerRequest shows that the selectedDate is “2013.8.17”; viewMode is “Timeline”; selectedViewMode is “Timeline”; and selectedTimelineViewMode is “Day15minutes”. Let’s start with the selectedDate part first. It is actually says that the selected date is September 17, 2013 (not August 17, 2013). The month part is started from zero instead of 1. You can try to navigate to January 2013 and the selectedDate will returns 2013.0.1.

The WebSchedulerRequest shows that the data is set to select.2013.8.17. This is the correct data for current view: September 17, 2013. This information aligns with your setting which says that you are using SingleLoad instead of TripleLoad. When you are using TripleLoad, you will get something like following: data="prev.2013.8.16;next.2013.8.18;select.2013.8.17".

The terms “working sample” in my previous post means that I need a working sample which replicates the reported problem since I was unable to reproduce it in my local end. On September 16, 2013 I was able to have the same issue by set the MaxJsonLength property to a smaller number. I’m afraid that this will not help much since you’ve said that set MaxJsonLength to the max value of 2147483647 doesn’t rectify the problem.

Please let us hear your response.

Hi Yudi,

The missing attached file is included below.

Frank

Hi Yudi,

Thanks so much for your prompt attention to helping us resolve the issue. I wanted to follow up on this post in case any other developers experience the same issue.

The max json error occurs when too much data is loaded into the control through the dataset query. With your help we were able to add parameters to our queries based on filtering the startdatetime for and only loading data for the date selected on the calendar by the user. We used the sample code provided in the high performance webcheduler sample.

Thanks again -

Frank

Yudi Support

Glad to hear the good news.

We also would like to express our gratitude to Frank and his team for the patience and cooperation.

Should you need further assistance or run into any problems regarding our controls, feel free to post it into our forum. We would be happy to assist you again.

We look forward to serving your future needs.

All times are GMT -5. The time now is 10:34 PM.
Previous Next