JSON deserialize errors
When I run some of the querys in a workflow, I get the following when attempting to select 90 records or more.
<Event Timestamp="2011-07-20T14:59:26.9731447-05:00" Level="ERROR" Identity="Guest"><Message>Error occured during REST request: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Parameter name: input</Message></Event>
<Event Timestamp="2011-07-20T15:06:03.642481-05:00" Level="ERROR" Identity="Guest"><Message>Unable to deserialize object: Invalid or unsupported json</Message></Event>
The max record return in the service is 10,000. When I run a global search for a high quantity query - I can get selections of 1500 or more.
So it seems that the workflow gets the records from the query task and fails when it gets to the select features if there are too many records.
Any ideas?
-
The problem still persists but I made a change to the web.config file:
From: http://stackoverflow.com/questions/1151987/unlimited-for-maxjsonlength
*************************
The MaxJsonLength property cannot be unlimited, is an integer property that has by default 2097152 characters (approx. 4MB of data).
You can set the MaxJsonLength property on your web.config:
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>It is an integer so the max value you can set is: 2147483644
I verified this on msdn.microsoft.com
*******************************
So I added the following to the web.config file:
C:\programfiles(x86)\Latitude Geographics\Geocortex Essentials\InstanceName\REST Elements\REST\Web.config</system.webServer>
<!-- 07-21-2011 Added the following to increase the length of json query results max value for mxJsonLength is 2147483644 -->
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions></configuration>
Restarted IIS - tested the workflow and still got the same errors.
0 -
Solution found:
The maxJsonLength setting didn't make any difference so I removed it from the xml file. The problem actually was with the data both FGDB or SDE Sqlserver. I'm not sure the problem exists with any other databases. The service layers that would error all had one thing in common - Very Large Text fields. Any layer that had a text field of 250 char or more would cause the error.
My short-term solution was to turn off those fields in the mxd/msd. After I did that, I could query large sets of records using workflow.
I did have a chance to try this in Oracle and it does not have a problem with it.
Hope this helps others.
0 -
I am having the same json error but only when i select multiple polygons that probably exceed the json max legth limit. We checked our web.config files and the limit was not set. where is the specific files we should set the limit in.
J
0 -
The 2MB maxJsonLength is a default imposed by the .NET Framework's JavaScriptSerializer. That web.config setting looks promising on the surface, but it does not actually apply here. It is only used for a different kind of web service.
In the next release of Essentials we have overridden the maxJsonLength to to be a huge value so you will no longer encounter this limit. Hooray! However, now that you can transfer more data you (as the workflow author) have to watch out for performance.
There are certainly legitimate cases for transferring a large amount of data in a workflow, for example: selecting hundreds of complex features. However, we have found that in a lot of cases the large data volumes are caused by to workflow inefficiencies. The most common culprit is a variable that remains in scope after it is no longer needed.
I would recommend that if you currently have this issue you should take a close look at your workflow and make sure you understand why your workflow needs to transfer 2MB+ of data for a particular activity.
--Ryan
0 -
Hi Ryan:
What version is to make super large json transfer possible?
We are experiencing the same error due to large geometries of selected features at times being transfered in json to a workflow. You wouldn't expect this to be an uncommon use case. Are there workflow solutions to this?
Thanks,
Ralph
0 -
Hi Ralph,
We removed the MaxJsonLength restriction in Essentials 3.10.
There are other IIS restrictions that limit incoming requests to 4MB by default. You'll see a different error message if this is the case "Maximum request length exceeded". You can override this limit in the web.config.
Prevention is usually the best option. I would try to look at how those giant geometries are obtained in the first place. If they came from a QueryTask in the workflow then you could consider using the MaxAllowableOffset property of the QueryTask to generalize it. This isn't appropriate in all situations, but it can make a significant difference.
--Ryan
0 -
Hi Ryan:
Many thanks for your quick reply. It does use a QueryTask. We would have to look into generalizing the features and whether appropriate. But you did get me thinking about whether the geometry is actually superfluous if known named places can simply be identified by their name and then queried elsewhere in our workflow to retrieve the geometries more easily.
Ralph
0
Please sign in to leave a comment.
Comments
7 comments