I have a rest API using .net 5.0. I want to use [RequestSizeLimit(100_000_000)] in just one endpoint. When using Kestrel it works, but I want to use it in IIS. I'm missing something? Important: My project has no web.config
! None of the solutions showed here: Increase upload file size in Asp.Net core solved my problem.
Asked
Active
Viewed 504 times
-1

infCAT
- 23
- 7
-
If you don't have `web.config` then you should add it. Without that how can you say that "None of the solutions ... solved my problem" when you didn't even try the solutions? You have to configure IIS via `web.config` or `applicationHost.config` to allow large payload, as hosting ASP.NET Core on IIS requires that extra configuration. – Lex Li Dec 16 '21 at 16:35
-
@LexLi I tried all solutions, and none of them work for me. I want to increase the requestsizelimit only on one endpoint, not on all the project. RequestSizeLimit only works using Kestrel, but this project is hosted using IIS. – infCAT Dec 16 '21 at 16:46
1 Answers
0
The RequestSizeLimit
attribute allows you to define the maximum request size within your code but it is still limited by maximum request size supported by the server itself, so you can try to set the request size through the maxAllowedContentLength
property in iis.
You can try to create a web.config file with the following content:
<system.webServer>
<security>
<requestFiltering>
<!-- This will handle requests up to 50MB -->
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>

samwu
- 3,857
- 3
- 11
- 25