question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function not allowing HTTP request body size more than 30MB after upgrading to .NET core 3.1

See original GitHub issue

Upgraded HTTP Function app framework to .NET core 3.1 and run time version to v3, and throwing the below error if the request body size is more than 30MB.

Error: Exception while executing function: Upload Exception binding parameter ‘req’ Request body too large. Microsoft.AspNetCore.Server.IIS.BadHttpRequestException

It was allowing up to 100MB when I was using .NET core 2.1 and v2 runtime.

Investigative information

  • Timestamp: 1/24/2020, 6:01:35 PM (Local time)
  • Function App version (1.0 or 2.0): azurefunctions: 3.0.13107
  • Invocation ID: 72f9e662-75ca-45d7-bc7f-73c72bf66ca0
  • Region: South Central

Repro steps

Provide the steps required to reproduce the problem:

  • Create HTTP Azure function with (Extensions,AzureKeyVault,DependencyInjection, HTTP, ActiveDirectory and SqlClient libraries)
  • Use .NET Core 3.1
  • Azure run time v3
  • Upload request more than 30MB

Project file: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <AzureFunctionsVersion>v3</AzureFunctionsVersion> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.1" /> <PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.6" /> <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.2" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.0" /> </ItemGroup> <ItemGroup> <None Update="host.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Update="local.settings.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToPublishDirectory>Never</CopyToPublishDirectory> </None> </ItemGroup> </Project>

Expected behavior

throws error

Known workarounds

downgraded to .NET core 2.1, run time version to v2 and function libraries: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp2.1</TargetFramework> <AzureFunctionsVersion>v2</AzureFunctionsVersion> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" /> <PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.6" /> <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" /> <PackageReference Include="System.Data.SqlClient" Version="4.6.1" /> </ItemGroup> <ItemGroup> <None Update="host.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> <None Update="local.settings.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToPublishDirectory>Never</CopyToPublishDirectory> </None> </ItemGroup> </Project>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
karpikplcommented, Jun 14, 2020

Hey, is that issue is still open? I’m running into this when running function locally.

Azure Functions Core Tools (3.0.2534 Commit hash: bc1e9efa8fa78dd1a138dd1ac1ebef97aac8d78e)
Function Runtime Version: 3.0.13353.0

.Net Core 3.1, functions V~3 Microsoft.NET.Sdk.Functions 3.0.7

[6/14/2020 4:22:14 AM] Executed 'RecordDocument' (Failed, Id=8353b29f-597e-4ecc-a050-ff6da4a5382b)
[6/14/2020 4:22:14 AM] System.Private.CoreLib: Exception while executing function: RecordDocument. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'req'. Microsoft.AspNetCore.Server.Kestrel.Core: Request body too large.
0reactions
weischermanuelcommented, Jun 29, 2020

Hey, is that issue is still open? I’m running into this when running function locally.

Azure Functions Core Tools (3.0.2534 Commit hash: bc1e9efa8fa78dd1a138dd1ac1ebef97aac8d78e)
Function Runtime Version: 3.0.13353.0

.Net Core 3.1, functions V~3 Microsoft.NET.Sdk.Functions 3.0.7

[6/14/2020 4:22:14 AM] Executed 'RecordDocument' (Failed, Id=8353b29f-597e-4ecc-a050-ff6da4a5382b)
[6/14/2020 4:22:14 AM] System.Private.CoreLib: Exception while executing function: RecordDocument. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'req'. Microsoft.AspNetCore.Server.Kestrel.Core: Request body too large.

Hi,

for me i’ve this error aswell while trying to upload a file above 100mb in debug mode.

same configuration

Read more comments on GitHub >

github_iconTop Results From Across the Web

Increase upload file size in Asp.Net core
1. IIS content length limit. The default request limit ( maxAllowedContentLength ) is 30,000,000 bytes, which is approximately 28.6 MB.
Read more >
Upload Large Files in ASP.NET Core
Upload Large Files in ASP.NET Core. By default, ASP.NET Core allows you to upload files up to 28 MB (approximately) in size.
Read more >
How to increase upload file size in ASP.NET Core
Today I learned the hard way that since ASP.NET Core 2.0, the request body has acquired a default size limit at 30MB (~28.6...
Read more >
KestrelServerLimits.MaxRequestBodySize Property
Gets or sets the maximum allowed size of any request body in bytes. When set to null, the maximum request body size is...
Read more >
IHttpMaxRequestBodySizeFeature Interface
The maximum allowed size of the current request body in bytes. When set to null, the maximum request body size is unlimited. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found