harriyott.com

Method Error 500 - Maximum Length Exceeded with AJAX web service call

I've been assigned a bug concerning a combo box. When the combo box is changed by the user, a secondary combo box has its values reloaded. This is done by calling a web service. The bug is that "Method Error 500" is displayed as the only item on occasion.

After some rooting around, it turns out that this is caused by too much data being returned in the SQL query behind the web service call, so the web service returns an error. A simple change to the web.config file can increase the size limit of data returned:

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