Adjusting the Maximum Request Length for ASP.NET Core and ASP.NET Applications (2024)

When making large HttpPost requests, such as uploading files or loading documents into the Document Viewer, the maximum request size is limited by default. Several settings are required in ASP.NET Core and ASP.NET applications to prepare applications to handle larger requests.

There are also differences in the hosting server depending on whether you are using .NET Kestrel or IIS. This article will cover the necessary settings for both hosting servers.

ASP.NET Core

ASP.NET Core applications have a default limit of 30MB for the maximum request size. This limit is set in the Program.cs file in the ConfigureServices method. The ConfigureServices method is where you can configure services that the application will use. The ConfigureServices method is called before the Configure method, which is where the application's request pipeline is configured.

Kestrel

To increase the maximum request size, you can use the Configure<KestrelServerOptions> method to configure the Kestrel server options. The Configure<KestrelServerOptions> method is called on the IServiceCollection interface, which is the collection of services that the application will use.

Here is an example of how to increase the maximum request size to approximately 8.59 GB:

builder.Services.Configure<KestrelServerOptions>(options =>
{
options.Limits.MaxRequestBodySize = int.MaxValue;
});

view raw test.cs hosted with ❤ by GitHub

IIS

If you are hosting an ASP.NET Core application in IIS, you must configure the maximum request size in web.config. The web.config file is an XML file containing application configuration settings. The web.config file is located in the application's root directory.

Here is an example of how to increase the maximum request size to the maximum value:

<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>

view raw test.config hosted with ❤ by GitHub

ASP.NET

The maximum request size for ASP.NET applications is limited to 4 MB by default. This limit is set by your web.config file.

IIS Request Filtering

At the IIS level, the Request Filtering module is used to limit the size of data that IIS accepts. Increase the maxAllowedContentLength value, which specifies the size of the POST buffer in bytes.

The default is 30000000 bytes (28.6 MB). The maximum value is 4294967295 bytes (4 GB).

Here is an example of how to increase the maximum request size:

<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>

view raw test.config hosted with ❤ by GitHub

HttpRuntime maxRequestLength

ASP.NET has its own setting for limiting the size of uploads and requests. Use the maxRequestLength property of the httpRuntime element.

The default size is 4096 kilobytes (4MB). The maximum value is 2,147,483,647 kilobytes (~82 terabytes). The following setting defines a maximum size of 500 megabytes.

The length of the request can be defined as follows:

<system.web>
<httpRuntime targetFramework="4.8" maxRequestLength="1048576" executionTimeout="120" />
</system.web>

view raw test.config hosted with ❤ by GitHub

These settings will allow you to handle larger requests in your ASP.NET Core and ASP.NET applications.

Conclusion

When making large HttpPost requests, such as uploading files or loading documents into the Document Viewer, the maximum request size is limited by default. Several settings are required in ASP.NET Core and ASP.NET applications to prepare applications to handle larger requests.

ASP.NET Core .NET 6 .NET 7 .NET 8 Angular Blazor React JavaScript

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

  • Download Trial
  • Trial Access Token

Getting started with:
  • ASP.NET Core
  • Angular
  • Blazor
  • JavaScript
  • React

Download Trial

Related Posts

ASP.NET

Impressions from DEVintersection 2024 in Las Vegas

by Bjoern Meyer| September 17, 2024

Last week, we exhibited at DEVintersection 2024 in Las Vegas. It was a great event with many interesting sessions and discussions. Here are some impressions from the conference.

Conference

ASP.NET Angular

Back from Copenhagen Developers Festival 2024

by Bjoern Meyer| September 5, 2024

We are back from the Copenhagen Developers Festival 2024. It was a great event where we showcased our latest products and technologies. We had many interesting conversations with developers and partners.

Conference

ASP.NET Angular

Using the Document Editor in SPA Applications using the removeFromDom Method

by Bjoern Meyer| September 2, 2024

This article shows how to use the removeFromDom method to remove the Document Editor from the DOM when it is no longer needed. This is useful when the Document Editor is used in a Single Page Application (SPA) and the component is not needed anymore.

Release Service Pack JavaScript SPA

ASP.NET Windows Forms WPF ActiveX

TX Text Control 32.0 Service Pack 4 Released

by Bjoern Meyer| September 2, 2024

We are very happy to announce the immediate availability of new Service Packs for TX Text Control 32.0 for all platforms including Windows Forms, WPF, ASP.NET, and ActiveX. This release includes various improvements and bug fixes.

Release Service Pack

Adjusting the Maximum Request Length for ASP.NET Core and ASP.NET Applications (2024)
Top Articles
Indexed Universal Life Insurance (IUL) Meaning and Pros and Cons
Cybersecurity | Nmap | TCP SYN Scan | Codecademy
The Tribes and Castes of the Central Provinces of India, Volume 3
Walgreens Boots Alliance, Inc. (WBA) Stock Price, News, Quote & History - Yahoo Finance
Spn 1816 Fmi 9
Wordscapes Level 6030
Sandrail Options and Accessories
Couchtuner The Office
Robinhood Turbotax Discount 2023
MADRID BALANZA, MªJ., y VIZCAÍNO SÁNCHEZ, J., 2008, "Collares de época bizantina procedentes de la necrópolis oriental de Carthago Spartaria", Verdolay, nº10, p.173-196.
Tamilblasters 2023
Obituary Times Herald Record
Full Range 10 Bar Selection Box
Lima Crime Stoppers
Raleigh Craigs List
National Weather Service Denver Co Forecast
Directions To 401 East Chestnut Street Louisville Kentucky
Sky X App » downloaden & Vorteile entdecken | Sky X
Theresa Alone Gofundme
NHS England » Winter and H2 priorities
Sound Of Freedom Showtimes Near Cinelux Almaden Cafe & Lounge
Fraction Button On Ti-84 Plus Ce
Strange World Showtimes Near Roxy Stadium 14
How To Level Up Roc Rlcraft
Zack Fairhurst Snapchat
Project, Time & Expense Tracking Software for Business
Rimworld Prison Break
Tips and Walkthrough: Candy Crush Level 9795
Cosas Aesthetic Para Decorar Tu Cuarto Para Imprimir
By.association.only - Watsonville - Book Online - Prices, Reviews, Photos
Publix Christmas Dinner 2022
Things to do in Pearl City: Honolulu, HI Travel Guide by 10Best
Vadoc Gtlvisitme App
Swgoh Boba Fett Counter
Manuel Pihakis Obituary
How to Get Into UCLA: Admissions Stats + Tips
Hermann Memorial Urgent Care Near Me
Andhra Jyothi Telugu News Paper
Jason Brewer Leaving Fox 25
15 Best Things to Do in Roseville (CA) - The Crazy Tourist
The Realreal Temporary Closure
Craigslist en Santa Cruz, California: Tu Guía Definitiva para Comprar, Vender e Intercambiar - First Republic Craigslist
What to Do at The 2024 Charlotte International Arts Festival | Queen City Nerve
Lorton Transfer Station
New Zero Turn Mowers For Sale Near Me
Is Chanel West Coast Pregnant Due Date
17 of the best things to do in Bozeman, Montana
Model Center Jasmin
2000 Fortnite Symbols
Marion City Wide Garage Sale 2023
How To Connect To Rutgers Wifi
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6145

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.