Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After the completion of about 40-45 APIs, the size of the authorization token is around 40 kb. And now after login whenever any request is being sent to the server it gives error of "Bad Request, Header too long.

What I have tried:

For Kestrel Server the blow code has been solved the error -

webBuilder.ConfigureKestrel(options =><br />
{<br />
options.Limits.MaxRequestHeadersTotalSize = 1048576;<br />
})


But for IIS Server I haven't got any kind of solution.
I have tried--
1) Increased the RequestLimit from web.config file.
2) Add the MaxFieldLength and MaxRequestBytes in HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/HTTP/Parameters
3) Add the below code in ConfigureServices method
ASP.NET
services.Configure(options => { options.AutomaticAuthentication = true; options.ForwardWindowsAuthentication = true; });


and many more tries but not got the final solution.
Please help if anyone can...
Posted
Comments
Richard Deeming 20-Aug-21 12:15pm    
Did you restart the server, or at least restart the IIS services, after adding the registry keys?

Personally, I'd be investigating why the header is so long. There shouldn't be any need to send a 40Kb header with every request!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900