File tree Expand file tree Collapse file tree 10 files changed +75
-1
lines changed
PdfViewerWebService_6.0 - Minimal API
PdfViewerWebService_8.0/PdfViewerWebService_8.0 Expand file tree Collapse file tree 10 files changed +75
-1
lines changed Original file line number Diff line number Diff line change 77using Microsoft . AspNetCore . HttpsPolicy ;
88using Microsoft . AspNetCore . Mvc ;
99using Microsoft . AspNetCore . ResponseCompression ;
10+ using Microsoft . AspNetCore . Server . Kestrel . Core ;
1011using Microsoft . Extensions . Configuration ;
1112using Microsoft . Extensions . DependencyInjection ;
1213using 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 =>
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 2222 } ) ;
2323} ) ;
2424
25+ // Configure Kestrel options
26+ builder . WebHost . ConfigureKestrel ( options =>
27+ {
28+ options . Limits . MaxRequestBodySize = 52428800 ; // 50 MB
29+ } ) ;
30+
2531builder . Services . AddMemoryCache ( ) ;
2632builder . Services . AddEndpointsApiExplorer ( ) ;
2733
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 1818 } ) ;
1919} ) ;
2020
21+ // Configure Kestrel options
22+ builder . WebHost . ConfigureKestrel ( options =>
23+ {
24+ options . Limits . MaxRequestBodySize = 52428800 ; // 50 MB
25+ } ) ;
26+
2127builder . Services . AddMemoryCache ( ) ;
2228builder . Services . AddEndpointsApiExplorer ( ) ;
2329
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 1818 } ) ;
1919} ) ;
2020
21+ // Configure Kestrel options
22+ builder . WebHost . ConfigureKestrel ( options =>
23+ {
24+ options . Limits . MaxRequestBodySize = 52428800 ; // 50 MB
25+ } ) ;
26+
2127builder . Services . AddMemoryCache ( ) ;
2228builder . Services . AddEndpointsApiExplorer ( ) ;
2329
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 1616 <namespaces >
1717 </namespaces >
1818 </pages >
19+ <!-- Size in KB (50 MB) -->
20+ <httpRuntime maxRequestLength =" 51200" />
1921 </system .web>
2022 <system .webServer>
2123 <httpProtocol >
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 >
Original file line number Diff line number Diff line change 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 >
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" >
You can’t perform that action at this time.
0 commit comments