I have a WEB API which returns some data which includes large byte array [file size is 400 MB] Now i am getting a response from API but while putting it into my class, i am getting an error as -
Exception of type 'System.OutOfMemoryException' was thrown at newtonsoft.json.JsonTextReader.PreparebufferForReadData
While calling an API -
HttpResponseMessage response = httpClient.GetAsync($"api/getdoc/{Id}").Result;
Here i am getting the valid response but it breaks down in ReadAsAsync
if (response.IsSuccessStatusCode)
{
responseCollection = response.Content.ReadAsAsync<IList<DocServiceResponse>>().Result;
}
My DocServiceResponse class -
public sealed class DocServiceResponse
{
#region Constructors
public DocServiceResponse()
{
}
#endregion
#region Properties
public Guid Code { get; set; }
public byte[] File_Stream { get; set; }
#endregion
}
Seems like its failing while deserializing byte array. Is there way to do it?