ScriptManagerを用いてAjaxでサービスを呼び出す際に、長い文字列(大きいデータ)をサービスメソッドに入力すると、
エラーが発生することがあります。
このエラーは、アプリケーションで設定されているmaxJsonLengthプロパティの規定値より長いデータが入力されたためです。(規定値は102400 文字です。)
maxJsonLengthプロパティのサイズを変更することでこの問題を回避できます。ASP.NETアプリケーションのWeb.Configファイルに以下を記載します。
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1024000000" />
</webServices>
</scripting>
</system.web.extensions>
Web.configファイルの例です。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1024000000" />
</webServices>
</scripting>
</system.web.extensions>
</configuration>