ASP.NET Core 3.0 上 WebAPI 响应的最大长度 [英] Maximal size length of WebAPI response on ASP.NET Core 3.0

查看:112
本文介绍了ASP.NET Core 3.0 上 WebAPI 响应的最大长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的控制器的一个操作在 JSON 响应中返回大量集合,当我向该控制器发出请求时,WebAPI 不返回响应.所以我使用断点测试了这个动作并且集合正常填充.最后,我确定这是 WebApi 的问题,因为我已经通过多个客户端(WPF 和 Postman)测试了该控制器的操作,并且每个客户端都在等待响应.我认为障碍是我的 WebAPI 的响应大小.我的 WebAPI 在 IIS Express 上运行

One of my controller's action returns huge collection in JSON response and when I make a request toward this controller WebAPI don't return a response. So I have tested this action using breakpoint and collection is filled normally. At the end I am sure that this is a problem of WebApi since I have tested this controller's action through several clients(WPF and Postman) and each one just hangs on waiting for a response. I think that the obstacle is the response size of my WebAPI. My WebAPI runs on IIS Express

所以我有两个问题:

1).ASP.NET Core 3.0 上 WebAPI 响应的最大长度是多少?
2).如何在 ASP.NET Core 3.0 上增加 WebAPI 响应的最大长度?

1). What is the maximal size length of WebAPI response on ASP.NET Core 3.0?
2). How to increase maximal size length of WebAPI response on ASP.NET Core 3.0?

推荐答案

我来这里是为了寻找相同问题的解决方案,但对我而言,它并没有通过更改 MaxResponseBufferSize 来解决.

I came here looking for a solution to the same problem, but for me it was not resolved by changing the MaxResponseBufferSize.

事实证明,Postman 似乎也返回了同样的错误,因为可以配置最大大小,默认为 50Mb.

As it turned out, it seems that Postman also returns this same error, as the maximum size can be configured, and the default is 50Mb.

在 Postman 应用程序中,您可以转到设置,并将其配置为 0(无限制)或您需要的任何值.

In the Postman application, you can go to settings, and configure this to be 0 (unlimited), or whatever value you need.

这篇关于ASP.NET Core 3.0 上 WebAPI 响应的最大长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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