Diego
Diego

Reputation: 796

Sending large json data to breezecontroller fail

I'm using breezejs to handle my entities on a web application.

Specifically i start with the Angular HotTowel template.

The problem i'm having is that i'm sending a large json array of objects (length about 17000) so on my controller im getting null on the parameter to receive this information.

When I try to send less data an array of 5000 objects then the controller parameter is setted with the objects correctlly.

My controller

[BreezeController]
public class SoftProductsController : ApiController
{
    private readonly EFContextProvider<Context> contextProvider = new EFContextProvider<Context>();

    [HttpGet]
    public string Metadata()
    {
        return this.contextProvider.Metadata();
    }

    [HttpPost]
    public SaveResult SaveChanges(JObject saveBundle)
    {
        //Here saveBundle is NULL
        return this.contextProvider.SaveChanges(saveBundle);

    }
}

Could be this related to some json deserialization on WebApi when using large json data?

I tried setting this option on the web.congif with no success

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

I'm using .NET 4.5

Any idea?

Upvotes: 2

Views: 2263

Answers (1)

Diego
Diego

Reputation: 796

My problem was the default limit on requestLenght that ASP.NET have. Increasing that limit on the web.config allow breeze to post large data. (default size is 4096 KB)

<system.web>
    <httpRuntime targetFramework="4.5" maxRequestLength="5120" />
</system.web>

https://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength(v=vs.110).aspx

Upvotes: 3

Related Questions