title: Uploading a file larger than 100 MB with .NET Core 3.1 will result in 400 (Bad Request)
body: <p>I am creating a file upload with .NET Core 3.1.</p>
  <p>When I uploaded a file larger than 100 MB, I got an error:</p>
  <blockquote>
  <p>413 Request Entity Too Large</p>
  </blockquote>
  <p>As a result of various investigations, I was able to avoid the 413 error by making the following settings:</p>
  <p><code>web.config</code>:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;configuration&gt;
    &lt;location path=&quot;.&quot; inheritInChildApplications=&quot;false&quot;&gt;
      &lt;system.webServer&gt;
        &lt;security&gt;
          &lt;requestFiltering&gt;
            &lt;!-- Handle requests up to 1 GB --&gt;
            &lt;requestLimits maxAllowedContentLength=&quot;1073741824&quot; /&gt;
          &lt;/requestFiltering&gt;
        &lt;/security&gt;
      &lt;/system.webServer&gt;
    &lt;/location&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p><code>UploadController.cs</code>:</p>
  <pre><code>        [Route(&quot;embed&quot;)]
          [HttpPost]
          [DisableRequestSizeLimit]
          [ProducesResponseType(StatusCodes.Status200OK)]
          [ProducesResponseType(StatusCodes.Status400BadRequest)]
          public ActionResult PostEmbed([FromForm] WebPptVoiceEmbedRequest request)
          {
              Log.NLog.Debug(&quot;[Get]:PostEmbed start&quot;);
  
              byte[] array;
              using (var stream = new MemoryStream())
              {
                  request.File.CopyTo(stream);
                  array = stream.ToArray();
              }
  
              Log.NLog.Debug(&quot;[Get]:PostEmbed end&quot;);
              
              return File(array, &quot;application/vnd.openxmlformats-officedocument.presentationml.presentation&quot;, request.File.FileName);
          }
  </code></pre>
  <p><code>Program.cs</code>:</p>
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
              Host.CreateDefaultBuilder(args)
                  .ConfigureWebHostDefaults(webBuilder =&gt;
                  {
                      webBuilder.ConfigureKestrel(options =&gt;
                      {
                          options.Limits.MaxRequestBodySize = null;
                      })
                      .UseStartup&lt;Startup&gt;();
                  })
                  .ConfigureLogging(logging =&gt;
                  {
                      logging.ClearProviders();
                      logging.SetMinimumLevel(LogLevel.Debug);
                  })
                  .UseNLog();
  </code></pre>
  <p><code>client.js</code></p>
  <pre><code>  let embedRequest = new FormData();
    embedRequest.append('file', file);
  
      const { data } = await axios
        .post(Api.embed, embedRequest, {
          responseType: 'blob',
          dataType: 'binary',
        })
        .catch((error) =&gt; {
          apiErrorLogAndThrow(error);
        });
      const blob = new Blob([data]);
      return blob;
  </code></pre>
  <p>However, I still get an error</p>
  <blockquote>
  <p>400 (Bad Request</p>
  </blockquote>
  <p>Is there a place to set the file upload capacity other than the place I set?<br />
  It's confusing because there are too many size settings in various places.</p>
  <p>I want to solve it first,<br />
  If possible, I would like to know how to solve it without using web.config.</p>
  <p>Best regards</p>