Maximum Length Exceeded

Last post 06-11-2008 12:35 PM by shabdar. 6 replies.

Sort Posts:

  • Maximum Length Exceeded

    01-25-2007, 2:53 PM
    • Member
      15 point Member
    • redundent
    • Member since 10-23-2006, 2:45 PM
    • Manhattan
    • Posts 9

    Hi,

     I am calling a server side method from javascript that returns a string. The string can be quite large. Occasionally I get an InvalidOperationException with a message of "Maximum length exceeded." Does anyone know what the maximum length is or how to get around it if possible.

     

    Thanks,

     

    Jason
     

    -Jason

    Now you're a man!
  • Re: Maximum Length Exceeded

    01-25-2007, 5:48 PM
    • Member
      15 point Member
    • redundent
    • Member since 10-23-2006, 2:45 PM
    • Manhattan
    • Posts 9


    Ignore this, I'm dumb. I didn't notice the maxJsonLength property and also didn't know it defaulted to around 1000 characters.

     

    Jason

    -Jason

    Now you're a man!
  • Re: Maximum Length Exceeded

    02-21-2007, 4:11 PM
    • Member
      80 point Member
    • dglsmason
    • Member since 09-08-2006, 7:18 PM
    • Posts 31

    I am having a similar problem (or maybe the same problem), but I changed the maxJsonLength in my web.config (copy below), and this did not help (details of my problem below). Ideas?

    <jsonSerialization maxJsonLength="50000">

    I am calling a web service from javascript and it returns a collection of objects.  Everything works fine until the web service returns a larger number of objects (601).  Via the debugger, the web service is working fine, and everything works okay when the number of objects is small. Ideas??

    My javascript call to web service: ILIMSWrapper.GetMaterials(queryField, queryValue, onILIMSsucceeded, onILIMSfailed);

    Results in calling the onILIMSfailed function, with error containing the following information:

    _exceptionType: System.InvalidOperationException

    _message: Maximum length exceeded.

    _stackTrace: at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams) at  System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)

  • Re: Maximum Length Exceeded

    02-27-2007, 4:48 PM
    • Member
      328 point Member
    • gpbenoit
    • Member since 10-19-2006, 2:13 PM
    • Atlanta, GA
    • Posts 98
    Has anyone solved this problem yet??
  • Re: Maximum Length Exceeded

    02-28-2007, 8:45 AM
    Answer
    • Member
      80 point Member
    • dglsmason
    • Member since 09-08-2006, 7:18 PM
    • Posts 31

    I made the following change in my web.config and everything seems ok now. It worked with only increasing from 500 to 500,000 but since my code is just a prototype, I added one more zero for now.  Increasing to 50,000 was not enough for my specific need.

    <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->

    <!--increased from default of 500 to 5,000,000-->

    <jsonSerialization maxJsonLength="5000000">

    <converters>

    <!--<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>-->

    </converters>

    </jsonSerialization>

  • Re: Maximum Length Exceeded

    02-28-2007, 10:46 PM
    • Member
      328 point Member
    • gpbenoit
    • Member since 10-19-2006, 2:13 PM
    • Atlanta, GA
    • Posts 98

    Thanks...that is what I ended up trying and it worked for me too.

  • Re: Maximum Length Exceeded

    06-11-2008, 12:35 PM
    • Member
      32 point Member
    • shabdar
    • Member since 10-30-2007, 11:02 PM
    • Canada
    • Posts 11
    Shabdar

    Please visit
    http://www.shabdar.org for more ASP.Net tutorials


    Click "Mark as Answer" on this post if it helped you.
Page 1 of 1 (7 items)