...
JavaScriptSerializer objSer = new JavaScriptSerializer();
objSer.MaxJsonLength = Int32.MaxValue;
...
Eğer web servis metodu sonucunda json dönüyor ve burada da değer artırmak istiyorsanız, web.config içinde tanımlama yapmalısınız.
O da şu şekildedir:
<configuration>
... <system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="2147483647"/> </webServices> </scripting> </system.web.extensions>
... </configuration>
Varsayılan değer:
The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.
Kaynaklar:
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.maxjsonlength(v=vs.110).aspx
http://codeasp.net/blogs/raghav_khunger/microsoft-net/752/exception-message-error-during-serialization-or-deserialization-using-the-json-javascriptserializer-the-length-of-the-string-exceeds-the-value-set-on-the-maxjsonlength-property
http://dotnetbyexample.blogspot.com/2007/11/expanding-lenght-of-json-data-returned.html
http://codeasp.net/blogs/raghav_khunger/microsoft-net/752/exception-message-error-during-serialization-or-deserialization-using-the-json-javascriptserializer-the-length-of-the-string-exceeds-the-value-set-on-the-maxjsonlength-property
http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config
http://support.microsoft.com/kb/981884/en-us
Hiç yorum yok:
Yorum Gönder