【发布时间】:2020-07-16 11:39:09
【问题描述】:
我使用了很多声明并将它们存储在令牌中。我之前只是在招摇时遇到过这个错误,清除缓存总是对我有用。但是,现在我在生产环境中看到了这个错误。给出此错误的当前“授权”标头约为 16kb。我试图增加 IIS 中的“授权”标头大小,将这些添加到 web.config
<system.web>
<httpRuntime maxRequestLength="500000000" executionTimeout="120" />
</system.web>
<location path="." inheritInChildApplications="false">
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="500000000" />
</requestFiltering>
</security>
并在 Kestrel 中添加了尝试增加的限制:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureKestrel((context, options) =>
{
options.Limits.MaxRequestHeadersTotalSize = 1048576;
});
}
以上都没有帮助。没找到其他解决方案,这里还有什么办法?
【问题讨论】:
-
support.microsoft.com/en-us/help/820129/… 传入的 HTTP 请求由 http.sys 检查,并且标头有大小限制。
-
谢谢。有没有办法让它超过64kb?如果您将此作为答案发布,我会接受。
-
@LexLi ,给我一个机会,让我试试。 (^.^)
-
如果@LexLi 没问题,我会接受你的回答
标签: asp.net-core iis