[英]Using Webclient with Foreach Loop to Download Webpages About 100,000
[英]RequestSizeLimit(100_000_000) not working on IIS
我有一个 rest API 使用 .net 5.0。 我想在一个端点中使用 [RequestSizeLimit(100_000_000)]。 使用 Kestrel 时它可以工作,但我想在 IIS 中使用它。 我错过了什么? 重要提示:我的项目没有web.config
:此处未显示任何解决方案: 在 Asp.Net 核心中增加上传文件大小解决了我的问题。
RequestSizeLimit
属性允许您在代码中定义最大请求大小,但它仍然受到服务器本身支持的最大请求大小的限制,因此您可以尝试通过 iis 中的maxAllowedContentLength
属性设置请求大小。
您可以尝试创建一个 web.config 文件,内容如下:
<system.webServer>
<security>
<requestFiltering>
<!-- This will handle requests up to 50MB -->
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.