Wednesday, March 26, 2014

JSON Webservice Error There was an error processing the request

I was dealing with this error for a couple or more hours with a JSOn Webservice in asp.net when calling from JQuery and Backbone.js client side application. When I was returning a simple entity it was working just fine but when I wanted to return a complex object type it was failing.

Any ways after looking and trying different things I found that the issue was with the max response limit was exceeding. Of course it was hard because there was no detail error log information any where. The webservice class was not throwing any particular exception. IIS was just return the Error 500 with this message.

Message":"There was an error processing the request.","

The FIX:

Simply added this to the web.config where the .ASMX class lives and the problem was solved.


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