开发者

maxJsonLength when consuming WCF service using Jquery

I am working on Google Map Marker V3.User can add Map Marker and additional info and this information is stored in sql Sever database. when the map page is loaded first time I retrieved all the markers stored in DB and display them on map. for Ajax call I am using WCF and Jquery. Every thing was working fine but one day I got an error

"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property".

For this I increase the size of maxJsonLength as following:

<system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="5000000"/>
      </webServices>
    </scripting>
  </system.web.extensions>

So for Now my application again working fine. My question is that is there any other way So that I can Increase this maxJsonLength at run time because开发者_如何转开发 I have to deliver this project to my client and if in future this same problem occurred this feature will stop working. I also found some other example on stackoverflow Can I set an unlimited length for maxJsonLength in web.config?

maxjsonlength-property

Thanks


You could set it to the max value 2147483644.

Probably your application will have serious performance problems before you hit the max value, so in a way it is unlimited since you will get other problems before you hit this liimtation.

There are problems with setting the limit very high:

  • You are more vulnerable to a denial of service attack
  • Your app could slow down and you get no information why (increasing payload size)

If I were you I would stick with the value you have now. And include info in the operations documentation that is they see that error they should increase the value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜