【问题标题】:nancy- Issue sending a large response body南希-发送大型响应正文的问题
【发布时间】:2016-10-01 03:18:54
【问题描述】:

所以我试图将大量数据发送回用户请求。

    var map = FindByName(name);
    if (map == null) 
        return Negotiate.WithStatusCode(HttpStatusCode.NotFound);
    Console.Write(map.products.Count());
    return Negotiate.WithStatusCode(HttpStatusCode.OK).WithModel(map);

我不知道确切的大小,我假设当 map.products(具有产品列表的对象)达到大约 1000 的大小时,我没有从服务器获取任何数据。

    var deferred = $q.defer();
    var url = requestUrl + "products/" + name;

    $http({
        url: url,
        method: "GET"
    }).success(function (data) {
        deferred.resolve(data);
        console.log("DATA: ", data);
    }).error(function (res, status, headers, config) {
        deferred.reject("Error: " + res);
    });

    return deferred.promise;

这是我用来取回响应的代码(用 angularJS 编写),如果大小太大,数据又是空的。当我用邮递员到达终点时也是如此。无论如何我可以将这个大对象作为 http 响应发回吗?

【问题讨论】:

    标签: angularjs nancy


    【解决方案1】:

    数据限制取决于服务器、客户端和可能的代理。请参考this回答

    【讨论】:

    • 我将如何将我的服务器的响应与 Nancy 分开?此外,当用户发出 POST 请求时,我的服务器的响应大小是否能够更大,那么将 POST 更改为 GET 可以解决这个问题吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多