Modify the MaxFieldLength and MaxRequestBytes to Completely Solve the Error "Request Too Long"

When The iis 6 or iis 7 or iis 7.5 received  the request header more than 16k of  the length(default), it will lead to the error of "Bad Request - Request Too Long. The HTTP Error 400. The size of  The Request headers is Too Long."

According to  the IIS official BBS posts (HTTP 400 Error. The size of The request headers is too long),The lenth of 16 k request header was  limited by  the two parameters MaxFieldLength (request) and MaxRequestBytes (request head and body) in the registry (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\\HTTP Parameters).So,we must do something on the  two parameters .

MaxFieldLength - Sets an upper limit for each header.( default 16 k)

MaxRequestBytes - Determines the upper limit for the total size of the Request line and the headers.( default 16 k)

Because both the default value is 16 k, so we have to adjust the MaxFieldLength and MaxRequestBytes value to 32 k or more.

Run regedit,enter  HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters.

1. Add the project type as dwords (32-bit), named MaxFieldLength, value is a decimal 32768 .

2. Add the project type as dwords (32-bit), named MaxRequestBytes, value is a decimal 32768.

MaxFieldLength MaxRequestBytes

Ok,but how to make them take effect ? The simplest method is to restart, but for the server, the most don't want to do is to restart.

Microsoft's official documents mentioned not restart solution, need to run the four commands:

net stop http
net start http
net stop iisadmin /y
net start servicename

But the third order net stop iisadmin will stop all using IIS related services, the fourth order need to start all the IIS services one by one.This is too cumbersome.There is a more simple method:

net stop http
net start http

Now problem  is solved.

This address is