0

I'm trying to send a large stringfy'ed JSON list array to a C# function using AngularJS

POST:

$http(
     {
          method: "POST",
          url: "/Home/IntegrityCheck",
          dataType: 'json',
          data: { bulkUpdateList: JSON.stringify(bulkUpdate) },
          headers: { "Content-Type": "application/json" }
      }).then(function (result) {

JSON example:

[{"ApplicationNo":"WHD00004925","field":"Decision","newValue":"Approved","idUser":"1"},
{"ApplicationNo":"WHD00005030","field":"AccountNumber","newValue":"100070","idUser":"1"}]

This works for up-to ~15,000 rows, but anything over and it instantly gives the following in the browser console...

angular.js:12845 POST http://localhost:50869/Home/IntegrityCheck 500 (Internal Server Error)

The C# function is never hit when the array is over a certain size (I've not been able to pin down the exact size it fails at, but is around 16,000+) the post will need to handle arrays of a max length of 450,000 rows.

My understanding is the max string I could send via post is something like 2 billion characters or 2GB in size, neither of which I'm getting remotely close to. I don't seem to have anything in my webconfig which would limit post messages to a controller.

EDIT... (stil doesn't work)

We're using IIS10 and Azure

I've updated my web config with...

<system.web>
    <httpRuntime maxRequestLength="1048576" /> 
</system.web>

<appSettings>
    <add key="aspnet:MaxJsonDeserializerMembers" value="2147483644" /> 
</appSettings>

<requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
Vereonix
  • 1,341
  • 5
  • 27
  • 54
  • What is the length of the largest JSON string that works (approximately)? The smallest JSON string that doesn't work (approximately)? – mjwills Oct 18 '18 at 11:42
  • Check this: https://stackoverflow.com/questions/16287706/how-to-upload-large-files-using-mvc-4 – Fabjan Oct 18 '18 at 11:46
  • If you use nginx or other web server, remember to set `client_max_body_size` or equivalent option as well, for some configurations the default is 10 megs, which is nowhere near enough for 450k rows. – Kilves Oct 18 '18 at 11:48
  • See this : https://stackoverflow.com/questions/52655444/how-to-increase-size-of-post-parameter-list/52655832#52655832 – Hamed Naeemaei Oct 18 '18 at 11:50
  • 1
    This is what you're looking for: https://stackoverflow.com/a/3853785/3390570 – Vlad C Oct 18 '18 at 11:57
  • @ethvlad this looks like it should be the fix, but I updated the web config and it is behaving exactly the same – Vereonix Oct 18 '18 at 12:14
  • @mjwills the character length of the max json that we know works is 1,305,000, and we know it fails around 1,755,000 – Vereonix Oct 18 '18 at 12:19

0 Answers0