Monday, March 27, 2017

web.config size limits

It turns out, microsoft has a size limit of 250KB on the web.config file of a web site by default.

I ran into this problem because a test website I maintain has a lot of things in its config file, and so the size went past the above threshold.

The workaround is this:
  1. If you create a DWORD MaxWebConfigFileSizeInKB under HKLM\SOFTWARE\Microsoft\InetStp\Configuration\ and set it to the number of kilobytes that the new max size limit must be, that will override the 250kb limit. 
  2. The registry key for IIS 7 / 7.5 running under 32 bit windows is HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB 
The above solves this for IIS. However, the issue will also cause a problem for you when developing your web site using IIS Express. The corresponding registry key for IIS express is:
  •  HKLM/HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\IISExpress\10.0\mimic\Configuration\MaxWebConfigFileSizeInKB 
And finally, this seems to not be a problem on Windows Azure - at least I did not hit the issue with a web.config of 260KB on Azure. However, I do not know if there is a size limit at all on Azure. Google did not help me shed any light on this.


No comments: