title: 413 request entity too large - Web API
body: <p>I'm running into a 413 issue while trying to send data from my web application (.netfx 4.6.1) to my web api (.net core 3.1).  In the code below, I send a list over containing byte data of images along with additional data needed to build a file.  The expected output is to return a byte array containing the new file.  Unfortunately when sending the request I receive an error: Response status code does not indicate success: 413 (Request Entity Too Large).</p>
  
  <p>The error only seems to occur when the file is large to begin with, which makes sense.  The research I've done seems to point to settings in IIS, the main ones being maxAllowedContentLength, maxRequestLength, and uploadReadAheadSize.  I've tried increasing these values to ones more suited to this process but nothing seems to work.  I've adjusted them for both the web application and the web api, as I was not sure which one was causing the problem.</p>
  
  <p>Where does the problem lie?  In the application, the API, or both?  Is there an additional setting I'm missing to allow an increased size?  Is there an issue with how I'm sending the request?  Any help is appreciated.</p>
  
  <pre><code>    public static async Task&lt;byte[]&gt; CreatePdfFromImageFilesAsync(List&lt;ImageFile&gt; imageFiles)
      {
          var list = new List&lt;dynamic&gt;();
          foreach (var item in imageFiles)
          {
              list.Add(new
              {
                  Data = Convert.ToBase64String(item.Bytes),
                  PageOrder = item.PageOrder,
                  Rotation = item.Rotation,
                  Type = "PDF"
              });
          }
  
          var response = _client.PostAsJsonAsync($"{FileCreatorAPI}/api/files/CreateFileFromMultiple", list).Result;
          var result = response.EnsureSuccessStatusCode();
          var bytes = await result.Content.ReadAsAsync&lt;byte[]&gt;();
          return bytes;
      }
  </code></pre>