title: How to download big CSV files(about 250MB) while running on IIS10? Content-length=0
body: <p>I have .net5.0 REST API hosted on IIS 10. I want to have a method to export data via CSV file.</p>
  <p>Code example:</p>
  <pre><code>[HttpGet]
  [Route(&quot;download-file&quot;)]
  [ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
  public ActionResult DownloadFile()
  {
      var data = GetData();
      using (var ms = new MemoryStream())
      {
          using (var sw = new StreamWriter(stream: ms, encoding: new UTF8Encoding(true)))
          {
              using (var cw = new CsvWriter(sw, CultureInfo.InvariantCulture, true))
              {
                  cw.WriteRecords(data);
              }
              return File(ms.ToArray(), &quot;application/octet-stream&quot;, &quot;fileName.csv&quot;);
          }
      }
  }
  </code></pre>
  <p>It works when there is not much data.</p>
  <p>The problem appears when file size raises up to 250MB then I get content-length: 0 without any errors. It happens only when the API hosted on IIS, when I host the API in Kestrel everything fine.</p>
  <p>I guess IIS has some response content length limitation.
  I tried setting maxAllowedContentLength attribute in web.config/directly in IIS in requestFiltering, but no results.</p>
  <p>Does anybody know how to solve this issue?</p>