Estoy publicando datos JSON en un servidor ASP.NET MVC2. Estoy publicando cadenas JSON grandes (que incorporan una secuencia de archivos codificada en base64, leída desde el sistema de archivos local). La llamada jQuery ajax funciona bien hasta tamaños de archivo de alrededor de 2.5Mb. Una vez por encima de este tamaño, la llamada ajax falla (nunca llega al controlador). No puedo detectar exactamente cuál es el error: parece que no llena las variables de error.La publicación jQuery .ajax falla con el objeto JSON grande
La llamada ajax es como sigue:
$.ajax({
type: "POST",
dataType: 'json',
timeout: 10000,
url: "/Molecule/SaveMolecule",
data: { jsonpost: postdata, moleculetype: _moleculeType, moleculefilestream: _moleculefilestream, changedproducts: stringifiedChangedProducts }, // NOTE the moleculeType being added here
success: function (data) {
if (data.rc == "success") {
$.log('ServerSuccess:' + data.message);
molecule_updateLocalInstance();
_bMoleculeIsDirty = false;
if (bReturnToMoleculeList != null && bReturnToMoleculeList == true) {
navigator_Go('/Molecule/Index/' + _moleculeType);
}
else {
_saveMoleculeButtonFader = setTimeout(function() {
$('#profilesave-container').delay(500).html('<img src="/content/images/tick.png" width="32px" height="32px" /><label>' + _moleculeSingularTerm + ' was saved</label>').fadeIn(500);
_saveMoleculeButtonFader = setTimeout(function() { $('#profilesave-container').fadeOut(1000); }, 2000);
}, 500);
}
} else {
$.log('ServerUnhappy:' + data.message);
RemoveMoleculeExitDialog();
}
}
, error: function (jqXHR, textStatus, errorThrown) {
alert('Save failed, check console for error message:' +textStatus+' '+ errorThrown);
MarkMoleculeAsDirty();
$.log('Molecule Save Error:' + helper_objectToString(textStatus+' '+errorThrown));
}
});
donde _moleculefilestream es la gran corriente codificado en base 64.
Mi web.config incluye lo siguiente:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
Alguien tiene alguna idea brillante?
Eso hizo el truco - ¡gracias! – Journeyman