I am using Virtual Basic with ASP.NET in Visual Studio 2008. I am using Webmethod to communicate from/to the server with the client. Data can be queried and returned in small amount, but when I try get a relatively large amount of data, it’s returning me a Server 500 error. My data is 226561 character long, so it’s not that large, but it’s relatively larger than my other working testing set, which are about 10k character long.
JavaScript:
PageMethods.my_func("context", success);
function success(result, userContext, methodName) {
alert("success!");
}
Failed Virtual Basic Code:
<System.Web.Services.WebMethod()> _
Public Shared Function my_func(ByVal context As String) As IEnumerable
var result = "..." '200k characters long
Return result
End Function
Successful Virtual Basic Code:
<System.Web.Services.WebMethod()> _
Public Shared Function my_func(ByVal context As String) As IEnumerable
var result = "..." '10k characters long
Return result
End Function
Is there anything I can change to increase WebMethod returned string length limit? Is there even a length limit or is it some other problem I could not see?
I believe that your issue may be with the maxJsonLength property (more info here).
You can adjust this setting in web.config: