从RESt API读取大数据时出错 [英] Error in reading large data from RESt API

查看:106
本文介绍了从RESt API读取大数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家

我在从REST api读取大数据时遇到困难。

I am facing difficulty in reading large data from REST api.

在我的C#代码中,我使用RESTClient从API读取

in My C# code, I am using RESTClient to read from API

======================= ======================

=============================================

RestClient客户端=新的RestClient(Uri);

                RestRequest request = new RestRequest(Method.GET);

                request.AddHeader(" Accept"," application / zip");

                request.AddHeader(" authorization",$" apikey {apiKey}");



                IRestResponse response = await Task.Run(()=> client.Execute(request));

                ResponseResult.RawBytes = response.RawBytes;

                ResponseResult.Data = ToReferenceData(new MemoryStream(response.RawBytes));

RestClient client = new RestClient(Uri);
                RestRequest request = new RestRequest(Method.GET);
                request.AddHeader("Accept", "application/zip");
                request.AddHeader("authorization", $"apikey {apiKey}");

                IRestResponse response = await Task.Run(() => client.Execute(request));
                ResponseResult.RawBytes = response.RawBytes;
                ResponseResult.Data = ToReferenceData(new MemoryStream(response.RawBytes));

======================== =========================

=================================================

REST api返回175 MB的zip文件。所以上面的代码总是以OutOfMemoryException失败

REST api returns 175 MB zip file. So the above code always fails with OutOfMemoryException

知道如何让这个工作吗?

Any idea how to get this working?

I尝试了HTTPClient,以及memoryStream,但没有工作。

I have tried HTTPClient, as well as memoryStream but didnt work.

如果有人知道如何解决这个问题,请提供帮助。

Please help if anybody knows how to get around this.

谢谢,

Gopal

推荐答案

嗨  Gopal_Shn,

Hi Gopal_Shn,

感谢您在此发帖。

由于此主题与RestClient相关,它是第三方产品,您可以使用以下格式发布。

Since this thread is related to RestClient, it is a third-party product, you could post in the following form.

https://groups.google.com/forum/#!forum/restsharp

https://groups.google.com/forum/#!forum/restsharp

注意:此响应包含参考ce到第三方万维网站点。 Microsoft提供此信息是为了方便您。 Microsoft不控制这些网站,也未测试这些网站上
的任何软件或信息;因此,Microsoft不能就其中发现的任何软件或信息的质量,安全性或适用性做出任何陈述。使用互联网上的任何软件都存在固有的危险,微软提醒您,在从互联网上检索任何软件之前,请确保您完全了解风险。

Note:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

Visual C#论坛讨论并询问有关C#编程语言,IDE,库,示例和工具的问题。

The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.





这篇关于从RESt API读取大数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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