Closed stijnherreman closed 8 years ago
According to the MSDN Docs, the default value for MaxJsonLength is "2097152 characters, which is equivalent to 4 MB of Unicode string data."
You say that it's logging SOAP communications. What type of data are you transferring via SOAP? I mean are you sending messages that you would expect to exceed 3 or 4 MB?
Judging by where you say that the error is happening (when viewing an error, not logging the error), I'm thinking that this is the call to Error.ToDetailedJson()
, which is written out to the webpage in a script tag, which the browser then interprets as a JavaScript object. But if this were to output more than 4 MB of JSON then you might end up having issues with your browser trying to deal with something that large (not to mention a long load time if it's having to be served over an internet connection).
Don't get me wrong, I'm not saying that you're doing anything wrong, just trying to help and figure out what you're trying to do. :wink:
@CptRobby some messages that we receive go up to 15 MB because they can contain PDFs in bas64 form.
We're doing the following: every request, a number of SOAP calls are done. We keep these in a per-request log store. If the request is completed succesfully, the data is discarded. If not, we throw and log an exception that includes all SOAP calls for that request.
I would personally not log that with the exception since that's a ton of data to rack up :) But if you must, that limit is adjustable. In your web.config
or app.config
here's the setting to up the that 2MB default limit:
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="20000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
@NickCraver I agree it's not an ideal solution, they should be logged separately and the exception should just include an identifier. But time and budget were not on my side :) I'll try the config change, thanks.
I have an error on the exceptions log screen that says:
It seems to be caused by trying to view a logged error. When I click on the most recent error in my log, this exception is thrown:
The log entry in question probably has a large exception message (it contains logged SOAP communication). If you need a DB dump of the entry, I can provide it to you via private communication.