'HTTP Error 400. The size of the request headers is too long in ASP.NET MVC-application
We created an ASP.NET MVC application that uses Windows Authentication. We now have the problem that we have some users who get the following error message when accessing the site:
HTTP Error 400. The size of the request headers is too long.
This seems to be due to the users being in too many Active Directory groups.
I already did the following:
I added the following registry keys on the server that is running the web-application:
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
I also set the following registry key on the client computer via which I accessed the web-application:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lsa\Parameters\MaxTokenSize ==> 65535
I then restarted all the computers and tried accessing the web-application again. I am still getting the above error message.
Does anybody have an idea what I can do? How can I further debug and analyze this problem?
Solution 1:[1]
Can you check it again by setting below request length limits as your need in web.config ?
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
and
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
Solution 2:[2]
I changed above settings manually on IIS root level through config editor and it worked for me in one one scenario.
I had to do so because the request wasnt event reaching till application \ virtual directly ( which I had checked in IIS logs)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nikunj Patel |
| Solution 2 | Sagar |

