title: Dotnet core 502 gateway with FileResult return
body: <p>i have a controller method that return an excel file developed using dotnet core 2.2. The method work fine while testing on my local IIS. However the same method returns a 502 gateway error when deployed as a container on openshift. Can someone please help understand the issue here. Also please note that these requests are routed through an Ocelot gateway api.</p>
  
  <pre><code>[HttpGet, Route("GetCaseFeedData")]
          public async Task&lt;FileResult&gt; GetCaseFeedData([FromQuery] int caseId, [FromQuery] int proposalId, [FromQuery] int equipmentId)
          {
              try
              {
                  var queryParams = new Dictionary&lt;string, string&gt; { { "caseId", caseId.ToString() }, { "proposalId", proposalId.ToString() }, { "equipmentId", equipmentId.ToString() } };
                  var restObj = _restFactory.createRestRequest(Method.GET, "PsaDataFetch-api/GetCaseFeedCompositionForSimulation", queryParams);
                  Console.WriteLine(restObj.Item2.BaseUrl);
                  var response = await restObj.Item2.ExecuteTaskAsync(restObj.Item1);
                  if (response.StatusCode == HttpStatusCode.OK)
                  {
                      var outPut = JsonConvert.DeserializeObject&lt;CaseFeedCompositionResponse&gt;(response.Content);
                      Console.WriteLine("inside status ok");
                      Console.WriteLine(_hostingEnvironment.ContentRootPath, "App_data", "PSASim v5.1 template.xlsm");
                      var excelPackage = await _excelService.PopulatePsaSimFile(outPut, Path.Combine(_hostingEnvironment.ContentRootPath, "App_Data", "PSASim v5.1 template.xlsm"));
                      return File(_excelHelper.ConvertExcelToByteArray(excelPackage), ContentTypeEnums.excel, "template"+".xlsm");
                  }
                  else
                  {
                      Console.WriteLine("inside else portion");
                      return null;
                  }
              }
  
              catch (Exception ex)
              {
                  Console.WriteLine(ex.Message);
                  throw ex;
              }
          }
  </code></pre>
  
  <p>UPDATE:
  I can see in the logs the below error message:</p>
  
  <p>[08:08:52 INF] Executed action method STSLog.PsaSIM.API.Controllers.PSASimulatorController.GetCaseFeedData (UOP.TOOLS.STSLOG.PSASIM.API.Web), returned result Microsoft.AspNetCore.Mvc.FileContentResult in 95501.3656ms.
  [08:08:52 INF] Executing Microsoft.AspNetCore.Mvc.FileContentResult, sending file with download name 'template.xlsm' ...
  [08:08:52 INF] Connection id "0HLTJF7INHERP", Request id "0HLTJF7INHERP:00000001": the application aborted the connection.</p>