用大数据调用post方法(12K对象)

时间:2017-03-02 15:55:23

标签: json asp.net-web-api restsharp

我正在尝试将数据集更新为webapi POST方法。如果data是1K行,则调用正常,但如果发送~12K行,则webapi为空。

public static string Update(string url, object data)
        {
            var client = GetClient();

            //request
            var request = new RestRequest(url, Method.POST);

            var json = request.JsonSerializer.Serialize(data);
            request.AddParameter("application/json; charset=utf-8", json, ParameterType.RequestBody);
            request.RequestFormat = DataFormat.Json;

            // execute the request
            var response = client.Execute(request);

            return response.Content; // raw content as string
        }

有任何建议吗?

1 个答案:

答案 0 :(得分:0)

maxRequestLength添加到web.config:

<system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime maxRequestLength="10000000" targetFramework="4.5.2" />
  </system.web>