Seeing this misinformation, the average developer may guess two reasons
1. There are special characters in the link
2. The link length is too long(It seems that the length is not the fault, it is vague, I forgot)
The address of the error image is as follows: http://{host}/SearchService. svc/rest/pic600x320/png/kv3hcxmnCmISVvFKojNBGpkN44MRx71vV4v7Qu7ikclbic2vX5Axnm8RxwhLoWyehsSz4J%C2% A72F6h4eQgvkrbzuKGR6y7sszK1KUY75RqxylZMumapwVQttfllaSPXwoRGEeVexDqjmMZSERPquL3uLZbv6Vxdx52nRDUW90SVVYeqkHZbx2w3T1coqt2v036tfaZ%C2%A72D8GBlPbIVJuhSFU5GA8116z8FkV4%C2% A72kDtsxSXy9XTFIziTToRpbQEkp7497O6q99
Next, we began to investigate the reasons for the errors we could encounter
1. Check the URL, there are no special characters (exclude this reason)
2. The url looks really long at first glance, so let's delete half the length of the parameter and then request it. The result is that it can be successful, and then by constantly adding characters, it is found that the length exceeds 339 and reports this error, and there are no special characters after 339, soWe basically determined that the cause of the error should be that the URL is too long。
The next step is to solve the relevant problems
Then there are various Baidu, check the configuration related to modifying the querystring length limit
Then modify the web.config
1. Modify the maxQueryStringLength and maxRequestLength configurations under the httpRuntime node
2. Modify the system.webServer node as follows
Saving and running with anticipation, the errors are still the same, and it seems that there is no use
At this time, I began to wonder, why not, will it not take effect, thinking that there may be many people like me, thinking of the global setting of IIS, will this setting not be overridden, we still use all the set values
Don't guess, just check it out (note that the requestFiltering you check is located under system.webServer, don't look at the wrong node)
If it is off, the value of overrideModeDefault is Deny, which means that our configuration will be based on the specific configuration of our site.
So everything is normal, why is it an error?!
Finally, a revert that was not adopted on stackoverflow caught my attention
linkhttps://stackoverflow.com/questi ... is-invalid-in-iis-7
Roughly speaking, the request has not yet reached IIS and is killed by the operating system.
At this time, I searched for another article on Google, which linked to Microsoft's optical radio technical support
The address is as followshttps://support.microsoft.com/zh ... ettings-for-windows
The gist of the two articles is that we need to modify the registry, and the two articles are probably modified by the following two values of the registry
Next, try it and go to the registry CMD="regedit="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters
Right-click on the blank area and select the Dword value, as shown in the picture
Create a new name called UrlSegmentMaxLength, set the value to 2048, and click OK
The setting of UrlSegmentMaxCount is the same as above, the value is also Dword 2048, click OK.
The modification can only take effect if the HTTP service is restarted
- Click Start, type Cmd, and then click OK.
- At the command prompt, type net stop http and press Enter.
- At the command prompt, type net start http and press Enter.
Then restart IIS. Try again, ok, no error, perfect solution
|