我将下面的代码放在web,config中,但是它不起作用。仍然出现上述错误。
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647" />
</webServices>
</scripting>
</system.web.extensions>
</configuration>
在控制器中,我有以下代码
string htmlTable = DataTransformer.ConvertDataTableToHtmlTable(dataTable, "revalidationtable");
return Json(new {
@DataTable = htmlTable,
@RevalidationMessage = revalidationMessage,
@RevalidationNotes = revalidationNotes,
@ModeSelect = modeSelect,
@ModeCheck = modeCheck
}, JsonRequestBehavior.AllowGet);
我已将控制器代码更改为此,但仍然显示相同的错误
var jsonResult = Json(new { @DataTable = htmlTable, @RevalidationMessage = revalidationMessage, @RevalidationNotes = revalidationNotes, @ModeSelect = modeSelect, @ModeCheck = modeCheck , JsonRequestBehavior.AllowGet } );
jsonResult.MaxJsonLength = Int32.MaxValue;
return jsonResult;