Skip to content

Commit 0d04403

Browse files
Merge pull request #18 from SyncfusionExamples/EJ2-911144-LargeDocument
Fixed large payload issue in large documents
2 parents 9072cd7 + 0af4f0e commit 0d04403

File tree

10 files changed

+75
-1
lines changed

10 files changed

+75
-1
lines changed

ASP.NET Core/PdfViewerWebService_5.0/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.HttpsPolicy;
88
using Microsoft.AspNetCore.Mvc;
99
using Microsoft.AspNetCore.ResponseCompression;
10+
using Microsoft.AspNetCore.Server.Kestrel.Core;
1011
using Microsoft.Extensions.Configuration;
1112
using Microsoft.Extensions.DependencyInjection;
1213
using Microsoft.Extensions.Hosting;
@@ -27,6 +28,7 @@ public Startup(IConfiguration configuration)
2728
// This method gets called by the runtime. Use this method to add services to the container.
2829
public void ConfigureServices(IServiceCollection services)
2930
{
31+
services.Configure<KestrelServerOptions>(options => options.Limits.MaxRequestBodySize = 52428800);
3032
services.AddControllers();
3133
services.AddMemoryCache();
3234
services.AddControllers().AddNewtonsoftJson(options =>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<security>
5+
<requestFiltering>
6+
<requestLimits maxAllowedContentLength="2147483647" />
7+
</requestFiltering>
8+
</security>
9+
</system.webServer>
10+
</configuration>

ASP.NET Core/PdfViewerWebService_6.0 - Minimal API/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
});
2323
});
2424

25+
// Configure Kestrel options
26+
builder.WebHost.ConfigureKestrel(options =>
27+
{
28+
options.Limits.MaxRequestBodySize = 52428800; // 50 MB
29+
});
30+
2531
builder.Services.AddMemoryCache();
2632
builder.Services.AddEndpointsApiExplorer();
2733

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<security>
5+
<requestFiltering>
6+
<requestLimits maxAllowedContentLength="2147483647" />
7+
</requestFiltering>
8+
</security>
9+
</system.webServer>
10+
</configuration>

ASP.NET Core/PdfViewerWebService_6.0/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
});
1919
});
2020

21+
// Configure Kestrel options
22+
builder.WebHost.ConfigureKestrel(options =>
23+
{
24+
options.Limits.MaxRequestBodySize = 52428800; // 50 MB
25+
});
26+
2127
builder.Services.AddMemoryCache();
2228
builder.Services.AddEndpointsApiExplorer();
2329

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<security>
5+
<requestFiltering>
6+
<requestLimits maxAllowedContentLength="2147483647" />
7+
</requestFiltering>
8+
</security>
9+
</system.webServer>
10+
</configuration>

ASP.NET Core/PdfViewerWebService_8.0/PdfViewerWebService_8.0/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
});
1919
});
2020

21+
// Configure Kestrel options
22+
builder.WebHost.ConfigureKestrel(options =>
23+
{
24+
options.Limits.MaxRequestBodySize = 52428800; // 50 MB
25+
});
26+
2127
builder.Services.AddMemoryCache();
2228
builder.Services.AddEndpointsApiExplorer();
2329

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<security>
5+
<requestFiltering>
6+
<requestLimits maxAllowedContentLength="2147483647" />
7+
</requestFiltering>
8+
</security>
9+
</system.webServer>
10+
</configuration>

ASP.NET MVC/MvcWebService_4.6/Web.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<namespaces>
1717
</namespaces>
1818
</pages>
19+
<!-- Size in KB (50 MB) -->
20+
<httpRuntime maxRequestLength="51200" />
1921
</system.web>
2022
<system.webServer>
2123
<httpProtocol>
@@ -25,6 +27,12 @@
2527
<add name="Access-Control-Max-Age" value="1728000" />
2628
</customHeaders>
2729
</httpProtocol>
30+
<security>
31+
<requestFiltering>
32+
<!-- Size in Bytes (50 MB) -->
33+
<requestLimits maxAllowedContentLength="52428800" />
34+
</requestFiltering>
35+
</security>
2836
<validation validateIntegratedModeConfiguration="false" />
2937
<modules runAllManagedModulesForAllRequests="true" />
3038
<handlers>

ASP.NET MVC/MvcWebService_4.8/Web.config

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<startup useLegacyV2RuntimeActivationPolicy="true">
88
</startup>
99
<system.web>
10-
<httpRuntime requestValidationMode="2.0" />
10+
<httpRuntime requestValidationMode="2.0" maxRequestLength="51200" />
1111
<compilation debug="true" targetFramework="4.8">
1212
<assemblies>
1313
</assemblies>
@@ -25,6 +25,12 @@
2525
<add name="Access-Control-Max-Age" value="1728000" />
2626
</customHeaders>
2727
</httpProtocol>
28+
<security>
29+
<requestFiltering>
30+
<!-- Size in Bytes (50 MB) -->
31+
<requestLimits maxAllowedContentLength="52428800" />
32+
</requestFiltering>
33+
</security>
2834
</system.webServer>
2935
<runtime>
3036
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

0 commit comments

Comments
 (0)