gpt4 book ai didi

c# - 使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串长度超过

转载 作者:行者123 更新时间:2023-11-30 07:12:41 25 4
gpt4 key购买 nike

""""""""""""""""""Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.","StackTrace":" at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"""""""""""""""""

我尝试了所有答案,但现在仍然出现此错误,请任何人提供帮助。

最佳答案

来自MSDN article由 fejescoco 链接,您必须在配置中指定最大长度。

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

关于c# - 使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串长度超过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20141310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com