HTTP错误400。在ASP.NET MVC应用程序中,请求标头的大小太长

时间:2020-02-07 09:27:01

标签: asp.net-mvc iis kerberos request-headers

我们创建了使用Windows身份验证的ASP.NET MVC应用程序。现在,我们遇到了一些用户访问网站时收到以下错误消息的问题:

HTTP Error 400. The size of the request headers is too long.

这似乎是由于用户所在的Active Directory组过多。

我已经做了以下事情:

我在运行Web应用程序的服务器上添加了以下注册表项:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ HTTP \ Parameters \ MaxFieldLength ==> 65536

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ HTTP \ Parameters \ MaxRequestBytes ==> 16777216

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Lsa \ Parameters \ MaxTokenSize ==> 65535

我还在通过其访问Web应用程序的客户端计算机上设置了以下注册表项:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Lsa \ Parameters \ MaxTokenSize ==> 65535

然后我重新启动了所有计算机,并尝试再次访问该Web应用程序。我仍然收到上述错误消息。

有人知道我能做什么吗? 如何进一步调试和分析此问题?

1 个答案:

答案 0 :(得分:0)

是否可以根据需要在web.config中设置低于请求长度限制的值来再次检查?

$content = json_encode($matchingCrops);

$this->response = $this->response->withStringBody($content);
$this->response = $this->response->withType('json');  
$this->autoRender = false; 
return $this->response;

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>