HTTP Error 404.13 – Not Found The request filtering module is
configured to deny a request that exceeds the request content length.Verify the
configuration/system.webServer/security/requestfiltering/requestLimits@maxAllowedContentLength
setting in the applicationhost.config or web.config file.
我不知道我在哪里可以配置,在asp.net核心2中有改变使用appsettings.json而不是.
甚至尝试这样做,但它不起作用.
services.Configure<FormOptions>(options => { options.MultipartBodyLengthLimit = 300_000_000; });
解决方法
如果您使用IIS,则需要在asp.net core 2.0 app中添加web.config.
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <security> <requestfiltering> <!-- This will handle requests up to 700MB (CD700) --> <requestLimits maxAllowedContentLength="737280000" /> </requestfiltering> </security> </system.webServer> </configuration>
如果您不使用IIS,则可以在控制器中使用[RequestSizeLimit(long.MaxValue)]或[disableRequestSizeLimit]属性.
此外,您可以在Program.cs中添加全局设置:
.UseKestrel(o => { o.Limits.MaxRequestBodySize = null; })
有关详细信息,请参阅此https://github.com/aspnet/Announcements/issues/267
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。