我正在创建一个 asp.net 2.0 webservice,它提供 json 作为输出,并且有一个非常大的、无法分解的数据集,它超过了最大长度限制
我在互联网上搜索过,.net 3.5 和 4 上有解决方案,但 2.0 没有。
谁能告诉我如何增加 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>