Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery ajax JSON响应太大_Ajax_Json_Web Services - Fatal编程技术网

jQuery ajax JSON响应太大

jQuery ajax JSON响应太大,ajax,json,web-services,Ajax,Json,Web Services,我有一个.NET web服务,它将字符串返回给jQuery$.ajax调用 如果字符串的长度小于88900(或更多),它可以正常工作,但只要我向字符串添加100个字符,它就不再工作了。我得到一个500内部服务器错误 如何解决此问题?jQuery不限制大小,但默认情况下ASP.NET会限制大小。您可以使用此web.config设置进行调整: <system.web.extensions> <scripting> <webServices>

我有一个.NET web服务,它将
字符串
返回给jQuery
$.ajax
调用

如果字符串的长度小于88900(或更多),它可以正常工作,但只要我向字符串添加100个字符,它就不再工作了。我得到一个
500内部服务器
错误


如何解决此问题?

jQuery不限制大小,但默认情况下ASP.NET会限制大小。您可以使用此web.config设置进行调整:

<system.web.extensions>
  <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="x">
        </jsonSerialization>
      </webServices>
  </scripting>
</system.web.extensions>

jQuery不限制大小,但默认情况下ASP.NET会限制大小。您可以使用此web.config设置进行调整:

<system.web.extensions>
  <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="x">
        </jsonSerialization>
      </webServices>
  </scripting>
</system.web.extensions>

您可以增加Json结果的最大长度

var list = Json(new { list = tasksList }, JsonRequestBehavior.AllowGet);

list.MaxJsonLength = int.MaxValue;

您可以增加Json结果的最大长度

var list = Json(new { list = tasksList }, JsonRequestBehavior.AllowGet);

list.MaxJsonLength = int.MaxValue;

非常感谢。你是个天才:)谢谢。你是个天才:)