Evgeniy
Evgeniy

Reputation: 555

webApi parameters data-length

How can I configurate WebApi Controller to read all data that passed in as a parameter?

Client:

  $.post(url,{id:aHugeData});

Controller:

 public class myController : ApiController
  {
   public List<string> Events(List<Event> id) //there must be 30 items, but I see 7
        {
            List<string> artists = new List<string>();
            foreach (Event e in id)
            {
                artists.AddRange(e.artists.artist);
            }
            artists = artists.Distinct().ToList();

            return artists;
        }
 }

in HttpContext I see that all data received.

Upvotes: 1

Views: 1374

Answers (1)

Evgeniy
Evgeniy

Reputation: 555

Form Url Encoded Formatter doesn't want to read confoguration from
httpRuntime maxRequestLength="80000000", so in global.asax:

  public static void Configure(HttpConfiguration conf)
    {
        conf.Formatters.FormUrlEncodedFormatter.ReadBufferSize = int.MaxValue/10;
    }

Upvotes: 1

Related Questions