The size of my web.config file is comfortably below max, but when adding +- 200 entries like <add ipAddress="" subnetMask="" allowed="false"/> I get a 500 error.

To avoid "do your research", these did not apply or fix:




Why the 500 error? And also, only control I have on this is via web.config as it's shared hosting and they don't do squat at their end.

1 Answer 1


It would appear that the default maximum size for the web.config file is 250K.

We have found an internal article that mentions that the reason for the 250KB limit is to reduce the chances of an attacker uploading a large web.config file. This is not just for migration of websites but also when deploying such large web.config files into existing website builds.

From learn.microsoft

It's not clear to me, but there may be other restrictions such as number of sections and number of lines.

The value can be changed here

HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB  (REG_DWORD)

or here

HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD)

There is documentation here Description of the registry keys that are used by Internet Information Services

Why the 500 error - because its an internal server error, which is what 500 is.

  • Yes I know 500 = server error, that was "Why would it trigger that". I also mentioned I know that the size of the web.config is well within bounds. Also I have no control over the registry as it's hosted and no-dice. Finally, 100% of this I have read almost as cut-and-paste, so thanks but not fixing it, and "Learn Microsoft" link... really? I thought this was a forum for going to actual knowledge first-hand not some Google result.
    – SKidd
    Mar 2, 2023 at 18:19
  • @SKidd, yes you mentioned that you know it's within the size, but you had not mentioned physical size and it was a possibility that you were referring to the number of lines. Finally adding approx 200 entries is increasing it a fair bit. Mar 3, 2023 at 2:08
  • The failing web.config is only 177kb, so well below the default max size of 250k
    – SKidd
    Mar 3, 2023 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.