从 Azure API 应用程序 (.NET Core) 截断的大型 JSON 响应 [英] Large JSON response truncated from Azure API app (.NET Core)

查看:38
本文介绍了从 Azure API 应用程序 (.NET Core) 截断的大型 JSON 响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个返回 JSON 的标准 .NET Core API 控制器.

I have a standard .NET Core API Controller that returns JSON.

一切都按设计进行,但对于更大的数据集,响应会被截断.

All works as designed but with larger data sets the response is being truncated.

我无法解决(或在 Stackoverflow 或其他地方找到)如何增加限制 - 假设这是原因.

I cannot work out (or find on Stackoverflow or elsewhere) how to increase the limit - presuming this is the cause.

有人能指出我正确的方向吗?

Can someone point me in the right direction please?

推荐答案

我有一个类似的问题,似乎解决它的是设置 'ReferenceLoopHandling' JSON 设置:

I had a similar issue and what seemed to fix it was setting the 'ReferenceLoopHandling' JSON setting:

public void ConfigureServices(IServiceCollection services)
{
        services.AddMvc().AddJsonOptions(options => {
            options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        });
 ...
}

这篇关于从 Azure API 应用程序 (.NET Core) 截断的大型 JSON 响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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