2012/08/14

maxJsonLength JavaScriptSerializer 예외

ASP.NET 사이트에서 json 데이터 요청을 ASP.NET 에서 처리를 하는 경우, 요청에 대한 응답값이 너무 큰 경우  "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property." 와 같은 예외가 발생할수 있음.

maxJsonLength  의 기본값은, 2097152 characters. 102400 (100k).

http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.maxjsonlength.aspx

web.config 에서 허용 값을 더 늘려줄수 있음.
<configuration>
       <system.web.extensions>
          <scripting>
              <webServices>
                  <jsonSerialization maxJsonLength="50000000"/>
              </webServices>
          </scripting>
      </system.web.extensions>
   </configuration>   




댓글 없음:

댓글 쓰기

가장 많이 본 글