HttpResponseMessage fileResponse = new HttpResponseMessage
{
Content = new ByteArrayContent(report) //here the byte array is >80000 in length
};
fileResponse.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/pdf");
return fileResponse;
У меня есть API, который возвращает файл PDF в виде массива байтов: [code]HttpResponseMessage fileResponse = new HttpResponseMessage { Content = new ByteArrayContent(report) //here the byte array is >80000 in length }; fileResponse.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/pdf"); return fileResponse; [/code] На клиенте у меня есть: [code]HttpResponseMessage result = null; using (HttpClient client = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true })) { result = await client.GetAsync(getFileURL); } Byte[] bytes = response.Content.ReadAsByteArrayAsync().Result; [/code] Этот код работал до обновления до .Net 5. Теперь длина байтов составляет всего