HTTP错误404.13-ASP.NET Core 2.0 [英] HTTP Error 404.13 - asp.net core 2.0
问题描述
HTTP错误404.13-找不到请求过滤模块已配置为
,以拒绝超出请求内容长度的请求。
HTTP Error 404.13 - Not Found The request filtering module is configured to deny a request that exceeds the request content length.
验证applicationhost.config或web.config文件中的
configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength
设置。
Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.
我不知道该在哪里配置,在asp.net core 2中已经更改为改为使用appsettings.json。
I've no idea to where can i config that, in asp.net core 2 there has change to use appsettings.json instead.
即使已经尝试执行此操作,也没有用。
Even try to do this already, but it's not work.
services.Configure<FormOptions>(options =>
{
options.MultipartBodyLengthLimit = 300_000_000;
});
推荐答案
如果使用IIS,则需要添加web.config在您的asp.net core 2.0应用中。
If you use IIS, you need add web.config in your asp.net core 2.0 app.
<?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]
属性。
If you are not using IIS you can use [RequestSizeLimit(long.MaxValue)]
or [DisableRequestSizeLimit]
attribute in your controller.
也可以在Program.cs中添加全局设置:
Also, you can add a global setting in Program.cs:
.UseKestrel(o => { o.Limits.MaxRequestBodySize = null; })
有关更多信息,请参见 https://github.com/aspnet/Announcements/issues/267
For more info see this https://github.com/aspnet/Announcements/issues/267
这篇关于HTTP错误404.13-ASP.NET Core 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!