参数的WebAPI的数据长度 [英] webApi parameters data-length

查看:259
本文介绍了参数的WebAPI的数据长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能configurate的WebAPI控制器读取传过来的参数全部数据?

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

客户:

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

控制器:

 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;
        }
 }

在HttpContext的我看到接收的所有数据。

in HttpContext I see that all data received.

推荐答案

表格网址恩$ C $光盘格式化并不想读取结果confoguration
  的httpRuntime的maxRequestLength =8000,所以在Global.asax中:

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;
    }

这篇关于参数的WebAPI的数据长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆