public JsonResult GetRenewalText(IFormFile files) { var objectResponce = new List <OutPutDTO>(); if (files != null) { byte[] byteArray; using (BinaryReader br = new BinaryReader(files.OpenReadStream())) { byteArray = br.ReadBytes((int)files.OpenReadStream().Length); // Convert the image in to bytes } InputData inputData = new InputData(); inputData.CsvFile = byteArray; using (var httpClient = new HttpClient()) { try { var myContent = JsonConvert.SerializeObject(inputData); var stringContent = new StringContent(myContent, Encoding.UTF8, Constant.ContentType); var result = httpClient.PostAsync(_configuration.GetValue <string>(Constant.BaseUrl), stringContent).Result; objectResponce = result.Content.ReadAsAsync <List <OutPutDTO> >().Result; foreach (var outdto in objectResponce) { outdto.FileName = outdto.CustomerId + "_" + outdto.FirstName; outdto.TextFile = Convert.ToBase64String(System.IO.File.ReadAllBytes(_getTextService.GetStream(outdto))); } } catch (Exception exception) { Logger.InsertLogs(exception); } } } return(Json(objectResponce)); }