1

I have a UI written in JavaScript with a .net core backend. My ajax call in JS looks like this:

const data = { users: userArray, message: sendMessage, url: optUrl };

$.ajax({
    type: "POST",
    url: `${App_Url}/ui/Notifications/send`,
    dataType: "application/json",
    data: JSON.stringify(data),
    success: (response) => {
        // if (spinner)
        //   spinner.stop();
        //
        notifySuccess("Users imported successfully!");
        $("#user_table").html(response);
    },
    error: (error) => {
        //if (spinner)
        //  spinner.stop();
        //
        notifyErrors(error.responseJSON.errors);
    }
});

Now the problem that I'm having is that when my userArray is bigger than some number (not sure what the number is) then my server seems to just drop the call. For example when my userArray is size 15 I can set a break point in the .NET controller and get to it just fine. However when my userArray is 1000 I don't even get to the break point and my server returns a 500. What is causing this and how do I go about fixing it?

My controller:

    [HttpPost("send")]
    [DisableRequestSizeLimit]
    public async Task<IActionResult> SendNotificationsAsync(CustomNotificationRq request)
    {
        var token = await _service.GetMiddlewareToken();
        var users = request.users;
        var message = request.message;
        var url = request.url;

        var response = await _service.SendNotificationAsync(users.ToList(), message, url, token.token);


        return response;
    }
1

1 Answer 1

3

You need to increase this value in your web.config in your .net core api application

<appSettings>
  <add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>
Sign up to request clarification or add additional context in comments.

2 Comments

.net core projects do not have web.config files and you cannot do this.
@ZantAgg All of my asp.net core projects all have web.config files so not sure why you would think otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.