Asp.net
ASP.NET 的 JSON 最大長度問題
我正在創建一個 asp.net 2.0 webservice,它提供 json 作為輸出,並且有一個非常大的、無法分解的數據集,它超過了最大長度限制
我在網際網路上搜尋過,.net 3.5 和 4 上有解決方案,但 2.0 沒有。
誰能告訴我如何增加 JSON 長度限制?
我有同樣的問題。看到 3.5 和 4.0 解決方案感到沮喪。原來你做同樣的事情,你只需要
<ConfigSections>在你的 Web.config 中的標籤中添加幾行。粘貼時它應該是根目錄下的第一個元素。<configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections>然後在實際
<system.web.extensions>部分添加:<system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="50000000"/> </webServices> </scripting> </system.web.extensions>