My ASP.NET 4.5
.asmx web service
(part of a web forms project, not separated) returns an xml string
whenever the user double-clicks on a table row so the details for that row can be retrieved from the database.
This, in and of itself, works fine.
In situations however, where the response is somewhat longer (around 200k, 300k char count from what I can see), the web page will throw a js alert popup (saying "Error") and I'll see a 500 Internal Server Error
in the Chrome console
, no further details. However, when I go to the web method url and enter the arguments manually, I'll get an immediate and complete xml string in response without issues.
I'm using the following (synchronous) js/ajax to call the web method:
function GetDetailsFromTableRow(userID, country, rowName) {
var url = "http://MyServer/MyWebService.asmx/MyWebMethod",
result = '';
$.ajax({
type: "POST",
async: false,
url: url,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify({
'userID': userID,
'country': country,
'rowName': rowName
}),
success: function (response) {
result = response.d;
},
error: function (x, t, m) {
if (t === "timeout") {
alert('timeout!');
}
else {
alert(t); //<- this gets thrown apparently
}
}
});
return result;
}
From this js you can ascertain that this function is, in fact, NOT throwing a timeout so I'm fairly certain I can eliminate that.
Furthermore, I would assume that I needn't chunk the response myself for data that is merely a few hundred kilobytes but still: I might be wrong.
I'm also quite aware that the better way to call web methods is asynchronously, but I'm succeeding in calling other (substantial) data already (both in async and sync ways) so I'm looking for an answer to the question why this is not working for responses over a certain size (I have responses that are 80kB and some that are 200+kB, the former work, the latter don't) because I'm obviously not understanding some parts of the whole story.
For completeness: an async=true
call to the web service causes the exact same behavior.